Browse Source

Introduce separate test for the 3-ary border call in CSS API

pull/893/head
Shagen Ogandzhanian 3 years ago
parent
commit
eb26f07240
  1. 2
      web/core/src/jsTest/kotlin/StaticComposableTests.kt
  2. 13
      web/core/src/jsTest/kotlin/css/CSSBorderTests.kt

2
web/core/src/jsTest/kotlin/StaticComposableTests.kt

@ -1,8 +1,6 @@
package org.jetbrains.compose.web.core.tests package org.jetbrains.compose.web.core.tests
import org.jetbrains.compose.web.css.Color
import org.jetbrains.compose.web.css.Position import org.jetbrains.compose.web.css.Position
import org.jetbrains.compose.web.css.border
import org.jetbrains.compose.web.css.bottom import org.jetbrains.compose.web.css.bottom
import org.jetbrains.compose.web.css.color import org.jetbrains.compose.web.css.color
import org.jetbrains.compose.web.css.left import org.jetbrains.compose.web.css.left

13
web/core/src/jsTest/kotlin/css/CSSBorderTests.kt

@ -5,6 +5,7 @@
package org.jetbrains.compose.web.core.tests.css package org.jetbrains.compose.web.core.tests.css
import kotlinx.browser.window
import org.jetbrains.compose.web.core.tests.runTest import org.jetbrains.compose.web.core.tests.runTest
import org.jetbrains.compose.web.css.* import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.dom.Div import org.jetbrains.compose.web.dom.Div
@ -23,13 +24,21 @@ class CSSBorderTests {
} }
assertEquals("1px solid red", (root.children[0] as HTMLElement).style.border) assertEquals("1px solid red", (root.children[0] as HTMLElement).style.border)
root.children[1]?.let { (root.children[1] as HTMLElement).let { el ->
val el = it.unsafeCast<HTMLElement>()
assertEquals("green", el.style.getPropertyValue("border-color")) assertEquals("green", el.style.getPropertyValue("border-color"))
assertEquals("3px", el.style.getPropertyValue("border-width")) assertEquals("3px", el.style.getPropertyValue("border-width"))
} }
} }
@Test
fun borderThreeValues() = runTest {
composition {
Div({ style { border(3.px, LineStyle.Dotted, Color("green")) } })
}
assertEquals("3px dotted green", (root.children[0] as HTMLElement).style.border)
}
@Test @Test
fun borderRadius() = runTest { fun borderRadius() = runTest {
composition { composition {

Loading…
Cancel
Save