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 {
Button(attrs = {
classes("a")
style {
color(Color.red)
}
if (hasValue) value("buttonValue")
if (hasValue) {
classes("b")
value("buttonValue")
}
}) {
Text("Button")
}
}
assertEquals(
expected = "color: red;",
actual = (root.firstChild as HTMLButtonElement).getAttribute("style")
)
assertEquals(
expected = null,
actual = (root.firstChild as HTMLButtonElement).getAttribute("value")
expected = "<button class=\"a\" style=\"color: red;\">Button</button>",
actual = nextChild().outerHTML
)
hasValue = true
waitForRecompositionComplete()
assertEquals(
expected = "color: red;",
actual = (root.firstChild as HTMLButtonElement).getAttribute("style")
)
assertEquals(
expected = "buttonValue",
actual = (root.firstChild as HTMLButtonElement).getAttribute("value")
expected = "<button class=\"a b\" style=\"color: red;\" value=\"buttonValue\">Button</button>",
actual = currentChild().outerHTML
)
}
}

Loading…
Cancel
Save