|
|
@ -12,36 +12,24 @@ import kotlin.test.assertTrue |
|
|
|
|
|
|
|
|
|
|
|
class ModifierTests { |
|
|
|
class ModifierTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun backgroundModifier() { |
|
|
|
fun backgroundModifier() = runTest { |
|
|
|
val root = "div".asHtmlElement() |
|
|
|
{ |
|
|
|
renderComposable( |
|
|
|
|
|
|
|
root = root |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
Box( |
|
|
|
Box( |
|
|
|
Modifier.background(Color(255, 0, 0)) |
|
|
|
Modifier.background(Color(255, 0, 0)) |
|
|
|
) { } |
|
|
|
) { } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val el = root.firstChild |
|
|
|
assertEquals("background-color: rgb(255, 0, 0);", nextChild().style.cssText) |
|
|
|
assertTrue(el is HTMLElement, "element not found") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals("background-color: rgb(255, 0, 0);", el.style.cssText) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun size() { |
|
|
|
fun size() = runTest { |
|
|
|
val root = "div".asHtmlElement() |
|
|
|
composition { |
|
|
|
renderComposable( |
|
|
|
|
|
|
|
root = root |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
Box( |
|
|
|
Box( |
|
|
|
Modifier.size(40.dp) |
|
|
|
Modifier.size(40.dp) |
|
|
|
) { } |
|
|
|
) { } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val el = root.firstChild |
|
|
|
assertEquals("width: 40px; height: 40px;", nextChild().style.cssText) |
|
|
|
assertTrue(el is HTMLElement, "element not found") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals("width: 40px; height: 40px;", el.style.cssText) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|