mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-05-18 08:11:18 +00:00
Introduce basic support for white-space in CSS API
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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(", "))
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user