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:
@@ -74,11 +74,9 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
|
||||
"checked" -> {
|
||||
checked = false
|
||||
}
|
||||
/*
|
||||
"class" -> {
|
||||
className = ""
|
||||
}
|
||||
*/
|
||||
"value" -> {
|
||||
this.value = ""
|
||||
}
|
||||
@@ -86,6 +84,8 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
|
||||
removeAttribute(attributeName)
|
||||
}
|
||||
}
|
||||
} else if (attributeName == "class") {
|
||||
className = ""
|
||||
} else {
|
||||
removeAttribute(attributeName)
|
||||
}
|
||||
@@ -95,11 +95,9 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
|
||||
"checked" -> {
|
||||
checked = "checked" == value
|
||||
}
|
||||
/*
|
||||
"class" -> {
|
||||
className = value
|
||||
}
|
||||
*/
|
||||
"value" -> {
|
||||
this.value = value
|
||||
}
|
||||
@@ -107,6 +105,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