From 2c4fe2ef6fd0a0bfa53f6496a1d4bede8fe9219d Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Tue, 16 Jan 2018 15:12:55 +0100 Subject: Radio button group form control --- .../treksoft/kvision/form/check/RadioGroupSpec.kt | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt (limited to 'src/test/kotlin') diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt new file mode 100644 index 00000000..b1dc19ea --- /dev/null +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt @@ -0,0 +1,30 @@ +package test.pl.treksoft.kvision.form.check + +import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.form.check.Radio +import pl.treksoft.kvision.form.check.RadioGroup +import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document +import kotlin.test.Test +import kotlin.test.assertEquals + +class RadioGroupSpec : DomSpec { + + @Test + fun render() { + run { + val root = Root("test") + val ci = RadioGroup(options = listOf("a" to "A", "b" to "B"), value = "a", label = "Label").apply { + disabled = true + inline = true + } + root.add(ci) + val element = document.getElementById("test") + val id = ci.flabel.forId + val rid1 = ci.getChildren().filterIsInstance().first().input.id + val rid2 = ci.getChildren().filterIsInstance().last().input.id + assertEquals("
", element?.innerHTML, "Should render correct radio button group form control") + } + } + +} \ No newline at end of file -- cgit