Browse Source

Basic support for letter-spacing in CSS API

pull/880/head
Shagen Ogandzhanian 3 years ago
parent
commit
7b8afd901b
  1. 9
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/font.kt
  2. 19
      web/core/src/jsTest/kotlin/css/CSSFontTests.kt

9
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/font.kt

@ -41,4 +41,13 @@ fun StyleBuilder.lineHeight(value: CSSNumeric) {
// https://developer.mozilla.org/en-US/docs/Web/CSS/font
fun StyleBuilder.font(value: String) {
property("font", value)
}
// https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing
fun StyleBuilder.letterSpacing(value: String) {
property("letter-spacing", value)
}
fun StyleBuilder.letterSpacing(value: CSSNumeric) {
property("letter-spacing", value)
}

19
web/core/src/jsTest/kotlin/css/CSSFontTests.kt

@ -104,6 +104,25 @@ class CSSFontTests {
assertEquals("2em", (root.children[1] as HTMLElement).style.lineHeight)
}
@Test
fun letterSpacing() = runTest {
composition {
Div({
style {
letterSpacing("normal")
}
})
Div({
style {
letterSpacing(2.em)
}
})
}
assertEquals("normal", (root.children[0] as HTMLElement).style.letterSpacing)
assertEquals("2em", (root.children[1] as HTMLElement).style.letterSpacing)
}
@Test
fun fontFamily() = runTest {
composition {

Loading…
Cancel
Save