Fix and test class attribute handling in ElementExtensions.
Some checks failed
Gradle CI / build (push) Has been cancelled
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user