Fix and test class attribute handling in ElementExtensions.
Some checks failed
Gradle CI / build (push) Has been cancelled

Re-enabled previously commented-out logic for managing the "class" attribute in ElementExtensions to ensure proper updates and removals. Added comprehensive unit tests in `TestClassUpdate` to verify behavior, including class addition, removal, and name changes. Bumped the project version to 1.2.6.
This commit is contained in:
2025-04-20 17:50:15 +02:00
parent 0d2f2146e9
commit 283c19defb
4 changed files with 79 additions and 9 deletions

View File

@@ -73,11 +73,9 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
"checked" -> {
checked = false
}
/*
"class" -> {
className = ""
}
*/
"value" -> {
this.value = ""
}
@@ -85,6 +83,8 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
removeAttribute(attributeName)
}
}
} else if (attributeName == "class") {
className = ""
} else {
removeAttribute(attributeName)
}
@@ -94,11 +94,9 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
"checked" -> {
checked = "checked" == value
}
/*
"class" -> {
className = value
}
*/
"value" -> {
this.value = value
}
@@ -106,6 +104,8 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
setAttribute(attributeName, value)
}
}
} else if (attributeName == "class") {
className = value
} else if (this.getAttribute(attributeName) != value) {
setAttribute(attributeName, value)
}