Browse Source

[web] [tests] Refactor attributesUpdateShouldNotCauseInlineStylesCleanUp and make sure we check conditional class assignemnt (in combination with seeting style) as well

pull/1112/head
Shagen Ogandzhanian 3 years ago
parent
commit
6c1667e05a
  1. 22
      web/core/src/jsTest/kotlin/elements/AttributesTests.kt

22
web/core/src/jsTest/kotlin/elements/AttributesTests.kt

@ -340,34 +340,30 @@ class AttributesTests {
composition { composition {
Button(attrs = { Button(attrs = {
classes("a")
style { style {
color(Color.red) color(Color.red)
} }
if (hasValue) value("buttonValue") if (hasValue) {
classes("b")
value("buttonValue")
}
}) { }) {
Text("Button") Text("Button")
} }
} }
assertEquals( assertEquals(
expected = "color: red;", expected = "<button class=\"a\" style=\"color: red;\">Button</button>",
actual = (root.firstChild as HTMLButtonElement).getAttribute("style") actual = nextChild().outerHTML
)
assertEquals(
expected = null,
actual = (root.firstChild as HTMLButtonElement).getAttribute("value")
) )
hasValue = true hasValue = true
waitForRecompositionComplete() waitForRecompositionComplete()
assertEquals( assertEquals(
expected = "color: red;", expected = "<button class=\"a b\" style=\"color: red;\" value=\"buttonValue\">Button</button>",
actual = (root.firstChild as HTMLButtonElement).getAttribute("style") actual = currentChild().outerHTML
)
assertEquals(
expected = "buttonValue",
actual = (root.firstChild as HTMLButtonElement).getAttribute("value")
) )
} }
} }

Loading…
Cancel
Save