From de143273e899b4818b15aadc5163b80da8ab2ca0 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Sat, 12 Jun 2021 01:55:49 +0200 Subject: [PATCH] Introduce test for attributes re-evaluation --- .../jsTest/kotlin/elements/AttributesTests.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/web/core/src/jsTest/kotlin/elements/AttributesTests.kt b/web/core/src/jsTest/kotlin/elements/AttributesTests.kt index 119e4bfb96..587b04dd63 100644 --- a/web/core/src/jsTest/kotlin/elements/AttributesTests.kt +++ b/web/core/src/jsTest/kotlin/elements/AttributesTests.kt @@ -125,4 +125,28 @@ class AttributesTests { 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("
", root.innerHTML) + + flag = false + + waitChanges() + assertEquals("
", root.innerHTML) + } } \ No newline at end of file