Skip to content

Commit

Permalink
web: make canvasAttributeTest independent of attributes order
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Karpovich committed Feb 14, 2022
1 parent 7a9776c commit bccf783
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions web/core/src/jsTest/kotlin/elements/AttributesTests.kt
Expand Up @@ -9,13 +9,11 @@ import kotlinx.dom.clear
import org.jetbrains.compose.web.attributes.*
import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLButtonElement
import org.w3c.dom.HTMLDivElement
import org.w3c.dom.HTMLElement
import org.jetbrains.compose.web.dom.Text
import kotlin.test.Test
import kotlin.test.assertEquals
import org.jetbrains.compose.web.testutils.*
import org.w3c.dom.HTMLInputElement
import org.w3c.dom.*
import kotlin.test.assertContains
import kotlin.test.assertTrue

Expand Down Expand Up @@ -556,9 +554,14 @@ class AttributesTests {
composition {
Canvas({
height(400.px)
width(400.px)
width(450.px)
})
}
assertEquals("""<canvas height="400px" width="400px"></canvas>""",root.innerHTML)
with(nextChild() as HTMLCanvasElement) {
val attrsMap = getAttributeNames().associateWith { getAttribute(it) }
assertEquals(2, attrsMap.size)
assertEquals("450px", attrsMap["width"])
assertEquals("400px", attrsMap["height"])
}
}
}

0 comments on commit bccf783

Please sign in to comment.