Bump version to 1.2.7, add TestSvg for testing SVG rendering, and remove redundant 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
This commit is contained in:
@@ -11,7 +11,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "nl.astraeus"
|
group = "nl.astraeus"
|
||||||
version = "1.2.6"
|
version = "1.2.7"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -84,8 +84,6 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
|
|||||||
removeAttribute(attributeName)
|
removeAttribute(attributeName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (attributeName == "class") {
|
|
||||||
className = ""
|
|
||||||
} else {
|
} else {
|
||||||
removeAttribute(attributeName)
|
removeAttribute(attributeName)
|
||||||
}
|
}
|
||||||
@@ -105,8 +103,6 @@ internal fun Element.setKompAttribute(attributeName: String, value: String?) {
|
|||||||
setAttribute(attributeName, value)
|
setAttribute(attributeName, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (attributeName == "class") {
|
|
||||||
className = value
|
|
||||||
} else if (this.getAttribute(attributeName) != value) {
|
} else if (this.getAttribute(attributeName) != value) {
|
||||||
setAttribute(attributeName, value)
|
setAttribute(attributeName, value)
|
||||||
}
|
}
|
||||||
|
|||||||
50
src/jsTest/kotlin/nl/astraeus/komp/TestSvg.kt
Normal file
50
src/jsTest/kotlin/nl/astraeus/komp/TestSvg.kt
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package nl.astraeus.komp
|
||||||
|
|
||||||
|
import kotlinx.browser.document
|
||||||
|
import kotlinx.html.InputType
|
||||||
|
import kotlinx.html.classes
|
||||||
|
import kotlinx.html.div
|
||||||
|
import kotlinx.html.i
|
||||||
|
import kotlinx.html.id
|
||||||
|
import kotlinx.html.input
|
||||||
|
import kotlinx.html.js.onClickFunction
|
||||||
|
import kotlinx.html.p
|
||||||
|
import kotlinx.html.span
|
||||||
|
import kotlinx.html.svg
|
||||||
|
import kotlinx.html.table
|
||||||
|
import kotlinx.html.td
|
||||||
|
import kotlinx.html.tr
|
||||||
|
import kotlinx.html.unsafe
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
import org.w3c.dom.HTMLDivElement
|
||||||
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
class TestSvgKomponent : Komponent() {
|
||||||
|
override fun HtmlBuilder.render() {
|
||||||
|
div {
|
||||||
|
+"Test"
|
||||||
|
|
||||||
|
svg("my-class") {
|
||||||
|
classes += "added-class"
|
||||||
|
unsafe {
|
||||||
|
+"""arc(1,2)"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestSvg {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testUpdateWithEmpty() {
|
||||||
|
val div = document.createElement("div") as HTMLDivElement
|
||||||
|
val rk = TestSvgKomponent()
|
||||||
|
|
||||||
|
Komponent.logRenderEvent = true
|
||||||
|
|
||||||
|
Komponent.create(div, rk)
|
||||||
|
|
||||||
|
println("SvgKomponent: ${div.printTree()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user