aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/kotlin')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt30
1 files changed, 30 insertions, 0 deletions
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<Radio>().first().input.id
+ val rid2 = ci.getChildren().filterIsInstance<Radio>().last().input.id
+ assertEquals("<div class=\"form-group kv-radiogroup-inline\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"radio\"><input id=\"$rid1\" type=\"radio\" name=\"$id\" disabled=\"\" value=\"a\"><label for=\"$rid1\">A</label></div><div class=\"radio\"><input id=\"$rid2\" type=\"radio\" name=\"$id\" disabled=\"\" value=\"b\"><label for=\"$rid2\">B</label></div></div>", element?.innerHTML, "Should render correct radio button group form control")
+ }
+ }
+
+} \ No newline at end of file