aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap-datetime/src/test
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-06 20:38:07 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-06 20:38:07 +0200
commit6b14906f0e35dc522bd1c1a44682d728315cf619 (patch)
tree4f96d1c3bb8281289b96e2b11eecc404a3c98788 /kvision-modules/kvision-bootstrap-datetime/src/test
parent6ddb5374d4f1f629c98392e104460351065eaa7c (diff)
downloadkvision-6b14906f0e35dc522bd1c1a44682d728315cf619.tar.gz
kvision-6b14906f0e35dc522bd1c1a44682d728315cf619.tar.bz2
kvision-6b14906f0e35dc522bd1c1a44682d728315cf619.zip
Update all tests.
Diffstat (limited to 'kvision-modules/kvision-bootstrap-datetime/src/test')
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt8
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt4
2 files changed, 7 insertions, 5 deletions
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
index 877cf650..5cdb68c9 100644
--- a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
+++ b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
@@ -25,6 +25,7 @@ import pl.treksoft.kvision.form.time.DateTimeInput
import pl.treksoft.kvision.panel.Root
import pl.treksoft.kvision.types.toStringF
import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
import kotlin.js.Date
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -41,10 +42,11 @@ class DateTimeInputSpec : DomSpec {
id = "idti"
}
root.add(dti)
- val value = dti.getElementJQuery()?.`val`()
+ val element = document.getElementById("test")
+ val datastr = data.toStringF(dti.format)
assertEquals(
- data.toStringF(dti.format),
- value,
+ "<div class=\"input-group date\" id=\"idti\"><input class=\"form-control\" placeholder=\"place\" type=\"text\" value=\"$datastr\"><div class=\"input-group-append\"><span class=\"input-group-text datepickerbutton\"><span class=\"fas fa-calendar-alt\"></span></span></div></div>",
+ element?.innerHTML,
"Should render date time input with correctly formatted value"
)
}
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
index eba3ef74..a6714f0c 100644
--- a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
+++ b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
@@ -46,13 +46,13 @@ class DateTimeSpec : DomSpec {
val id = ti.input.id
val datastr = data.toStringF(ti.format)
assertEqualsHtml(
- "<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"text\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" value=\"$datastr\"></div>",
+ "<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group date\" id=\"$id\"><input class=\"form-control\" placeholder=\"place\" name=\"name\" disabled=\"\" type=\"text\" value=\"$datastr\"><div class=\"input-group-append\"><span class=\"input-group-text datepickerbutton\"><span class=\"fas fa-calendar-alt\"></span></span></div></div></div>",
element?.innerHTML,
"Should render correct date time input form control"
)
ti.validatorError = "Validation Error"
assertEqualsHtml(
- "<div class=\"form-group text-danger\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"text\" placeholder=\"place\" name=\"name\" disabled=\"disabled\" value=\"$datastr\"><span class=\"help-block small\">Validation Error</span></div>",
+ "<div class=\"form-group text-danger\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group date is-invalid\" id=\"$id\"><input class=\"form-control is-invalid\" placeholder=\"place\" name=\"name\" disabled=\"\" type=\"text\" value=\"$datastr\"><div class=\"input-group-append\"><span class=\"input-group-text datepickerbutton\"><span class=\"fas fa-calendar-alt\"></span></span></div></div><div class=\"invalid-feedback\">Validation Error</div></div>",
element?.innerHTML,
"Should render correct date time input form control with validation error"
)