Browse Source

Move relevant tests from StaticComposableTests to CSSBoxTests

pull/871/head
Shagen Ogandzhanian 3 years ago
parent
commit
362c010045
  1. 36
      web/core/src/jsTest/kotlin/StaticComposableTests.kt
  2. 52
      web/core/src/jsTest/kotlin/css/CSSBoxTests.kt

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

@ -257,24 +257,6 @@ class StaticComposableTests {
assertEquals("flex-shrink: 0.6;", (root.children[3] as HTMLElement).style.cssText)
}
@Test
fun stylesWidth() {
val root = "div".asHtmlElement()
renderComposable(
root = root
) {
Div(
{
style {
width(100.px)
}
}
)
}
assertEquals("width: 100px;", (root.children[0] as HTMLElement).style.cssText)
}
@Test
fun stylesBorderRadius() {
val root = "div".asHtmlElement()
@ -424,24 +406,6 @@ class StaticComposableTests {
assertEquals("right: 100%;", (root.children[1] as HTMLElement).style.cssText)
}
@Test
fun stylesHeight() {
val root = "div".asHtmlElement()
renderComposable(
root = root
) {
Div(
{
style {
height(100.px)
}
}
)
}
assertEquals("height: 100px;", (root.children[0] as HTMLElement).style.cssText)
}
@Test
fun stylesDisplay() {
val root = "div".asHtmlElement()

52
web/core/src/jsTest/kotlin/css/CSSBoxTests.kt

@ -0,0 +1,52 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.web.core.tests.css
import org.jetbrains.compose.web.core.tests.asHtmlElement
import org.jetbrains.compose.web.core.tests.runTest
import org.jetbrains.compose.web.css.height
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.width
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.renderComposable
import org.w3c.dom.HTMLElement
import org.w3c.dom.get
import kotlin.test.Test
import kotlin.test.assertEquals
class CSSBoxTests {
@Test
fun stylesWidth() = runTest {
composition {
Div(
{
style {
width(100.px)
}
}
)
}
assertEquals("100px", (root.children[0] as HTMLElement).style.width)
}
@Test
fun stylesHeight() = runTest {
composition {
Div(
{
style {
height(90.px)
}
}
)
}
assertEquals("90px", (root.children[0] as HTMLElement).style.height)
}
}
Loading…
Cancel
Save