Shagen Ogandzhanian
3 years ago
2 changed files with 52 additions and 36 deletions
@ -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…
Reference in new issue