aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-10-19 15:22:42 +0200
committerRobert Jaros <rjaros@finn.pl>2017-10-19 15:22:42 +0200
commitd591af011d040d8ce2684f044b594d28ab358ef9 (patch)
tree89ec92f3d72d535dc6507b68b70ae326797b28eb /src/test
parent6caae545b7961f9ba5f136d38730ecf026ab7fbb (diff)
downloadkvision-d591af011d040d8ce2684f044b594d28ab358ef9.tar.gz
kvision-d591af011d040d8ce2684f044b594d28ab358ef9.tar.bz2
kvision-d591af011d040d8ce2684f044b594d28ab358ef9.zip
Form controls: TextArea
Diffstat (limited to 'src/test')
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/PasswordSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaInputSpec.kt24
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaSpec.kt25
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/TextInputSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/TextSpec.kt2
5 files changed, 52 insertions, 3 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/PasswordSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/PasswordSpec.kt
index 4563da03..b03112a7 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/PasswordSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/PasswordSpec.kt
@@ -19,7 +19,7 @@ class PasswordSpec : DomSpec {
root.add(ti)
val element = document.getElementById("test")
val id = ti.input.id
- assertEquals("<div class=\"form-group\"><label for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"password\" placeholder=\"place\" value=\"abc\" name=\"name\" maxlength=\"15\" disabled=\"\"></div>", element?.innerHTML, "Should render correct input form field")
+ assertEquals("<div class=\"form-group\"><label for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" type=\"password\" value=\"abc\"></div>", element?.innerHTML, "Should render correct input form field")
}
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaInputSpec.kt
new file mode 100644
index 00000000..630a0eed
--- /dev/null
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaInputSpec.kt
@@ -0,0 +1,24 @@
+package test.pl.treksoft.kvision.form
+
+import pl.treksoft.kvision.core.Root
+import pl.treksoft.kvision.form.TextAreaInput
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class TextAreaInputSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test")
+ val ti = TextAreaInput(cols = 5, rows = 2, placeholder = "place", value = "abc", name = "name",
+ maxlength = 15, id = "idti", disabled = true)
+ root.add(ti)
+ val element = document.getElementById("test")
+ assertEquals("<textarea class=\"form-control\" id=\"idti\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" cols=\"5\" rows=\"2\">abc</textarea>", element?.innerHTML, "Should render correct input field")
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaSpec.kt
new file mode 100644
index 00000000..e422ac2b
--- /dev/null
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/TextAreaSpec.kt
@@ -0,0 +1,25 @@
+package test.pl.treksoft.kvision.form
+
+import pl.treksoft.kvision.core.Root
+import pl.treksoft.kvision.form.TextArea
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class TextAreaSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test")
+ val ti = TextArea(cols = 5, rows = 2, placeholder = "place", value = "abc", name = "name",
+ maxlength = 15, disabled = true, label = "Label")
+ root.add(ti)
+ val element = document.getElementById("test")
+ val id = ti.input.id
+ assertEquals("<div class=\"form-group\"><label for=\"$id\">Label</label><textarea class=\"form-control\" id=\"$id\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" cols=\"5\" rows=\"2\">abc</textarea></div>", element?.innerHTML, "Should render correct input form field")
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/TextInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/TextInputSpec.kt
index 55325436..9e5ed64d 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/TextInputSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/TextInputSpec.kt
@@ -18,7 +18,7 @@ class TextInputSpec : DomSpec {
maxlength = 15, id = "idti", disabled = true)
root.add(ti)
val element = document.getElementById("test")
- assertEquals("<input class=\"form-control\" id=\"idti\" type=\"password\" placeholder=\"place\" value=\"abc\" name=\"name\" maxlength=\"15\" disabled=\"\">", element?.innerHTML, "Should render correct input field")
+ assertEquals("<input class=\"form-control\" id=\"idti\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" type=\"password\" value=\"abc\">", element?.innerHTML, "Should render correct input field")
}
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/TextSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/TextSpec.kt
index 5e378d55..675d9db8 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/TextSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/TextSpec.kt
@@ -18,7 +18,7 @@ class TextSpec : DomSpec {
root.add(ti)
val element = document.getElementById("test")
val id = ti.input.id
- assertEquals("<div class=\"form-group\"><label for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"text\" placeholder=\"place\" value=\"abc\" name=\"name\" maxlength=\"15\" disabled=\"\"></div>", element?.innerHTML, "Should render correct input form field")
+ assertEquals("<div class=\"form-group\"><label for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" type=\"text\" value=\"abc\"></div>", element?.innerHTML, "Should render correct input form field")
}
}