diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/text.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/text.kt index 899867453a..319d765061 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/text.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/text.kt @@ -88,4 +88,9 @@ fun StyleBuilder.textDecorationLine(value: String) { // https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration fun StyleBuilder.textDecoration(value: String) { property("text-decoration", value) +} + +// https://developer.mozilla.org/en-US/docs/Web/CSS/white-space +fun StyleBuilder.whiteSpace(value: String) { + property("white-space", value) } \ No newline at end of file diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/ui.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/ui.kt index e46c2a5984..8d713e991f 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/ui.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/ui.kt @@ -5,6 +5,7 @@ package org.jetbrains.compose.web.css +// https://developer.mozilla.org/en-US/docs/Web/CSS/cursor fun StyleBuilder.cursor(vararg value: String) { property("cursor", value.joinToString(", ")) } \ No newline at end of file diff --git a/web/core/src/jsTest/kotlin/css/CSSTextTests.kt b/web/core/src/jsTest/kotlin/css/CSSTextTests.kt index 3d814126dd..3f29c780e4 100644 --- a/web/core/src/jsTest/kotlin/css/CSSTextTests.kt +++ b/web/core/src/jsTest/kotlin/css/CSSTextTests.kt @@ -353,4 +353,48 @@ class CSSTextTests { assertEquals("line-through", (root.children[2] as HTMLElement).style.textDecoration) assertEquals("underline overline dashed", (root.children[3] as HTMLElement).style.textDecoration) } + + @Test + fun whiteSpace() = runTest { + composition { + Div({ + style { + whiteSpace("normal") + } + }) + Div({ + style { + whiteSpace("nowrap") + } + }) + Div({ + style { + whiteSpace("pre") + } + }) + Div({ + style { + whiteSpace("pre-wrap") + } + }) + Div({ + style { + whiteSpace("pre-line") + } + }) + Div({ + style { + whiteSpace("break-spaces") + } + }) + } + + assertEquals("normal", (root.children[0] as HTMLElement).style.whiteSpace) + assertEquals("nowrap", (root.children[1] as HTMLElement).style.whiteSpace) + assertEquals("pre", (root.children[2] as HTMLElement).style.whiteSpace) + assertEquals("pre-wrap", (root.children[3] as HTMLElement).style.whiteSpace) + assertEquals("pre-line", (root.children[4] as HTMLElement).style.whiteSpace) + assertEquals("break-spaces", (root.children[5] as HTMLElement).style.whiteSpace) + } + } \ No newline at end of file