Browse Source

Introduce test for attributes re-evaluation

ATTR_EXPERIMENT
Shagen Ogandzhanian 3 years ago
parent
commit
de143273e8
  1. 24
      web/core/src/jsTest/kotlin/elements/AttributesTests.kt

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

@ -125,4 +125,28 @@ class AttributesTests {
actual = div.getAttribute("class") actual = div.getAttribute("class")
) )
} }
@Test
fun attributesRecreated() = runTest {
var flag by mutableStateOf(true)
composition {
Div({
if (flag) {
attr("a", "aa")
attr("b", "bb")
} else {
attr("b", "pp")
attr("c", "cc")
}
})
}
assertEquals("<div a=\"aa\" b=\"bb\"></div>", root.innerHTML)
flag = false
waitChanges()
assertEquals("<div b=\"pp\" c=\"cc\"></div>", root.innerHTML)
}
} }
Loading…
Cancel
Save