diff options
Diffstat (limited to 'src/test/kotlin')
42 files changed, 316 insertions, 73 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt index a169ace6..e0bc16da 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/core/ContainerSpec.kt @@ -1,8 +1,8 @@ package test.pl.treksoft.kvision.core -import pl.treksoft.kvision.panel.SimplePanel import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.core.Widget +import pl.treksoft.kvision.panel.SimplePanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test @@ -82,6 +82,7 @@ class ContainerSpec : DomSpec { assertTrue("Children are not rendered") { elem1 == null && elem2 == null } } } + @Test fun getChildren() { run { diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt index a053627d..01aee755 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt @@ -20,7 +20,11 @@ class WidgetWrapperSpec : DomSpec { wrapper.width = 100 to UNIT.em root.add(wrapper) val element = document.getElementById("test") - assertEquals("<div style=\"width: 100em;\"><div></div></div>", element?.innerHTML, "Should render widget inside custom wrapper") + assertEquals( + "<div style=\"width: 100em;\"><div></div></div>", + element?.innerHTML, + "Should render widget inside custom wrapper" + ) widget.hide() assertEquals("", element?.innerHTML, "Should not render wrapper when widget is hidden") } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt index 7b9b16e4..30cf0db9 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt @@ -16,18 +16,32 @@ class DataContainerSpec : DomSpec { fun render() { run { val root = Root("test") + class Model(value: String) : DataComponent() { var value: String by obs(value) } + val model = observableListOf(Model("First"), Model("Second")) val container = DataContainer(model, { element, _ -> Label(element.value) }) root.add(container) val element = document.getElementById("test") - assertEquals("<div style=\"display: flex; flex-direction: column;\"><div><span>First</span></div><div><span>Second</span></div></div>", element?.innerHTML, "Should render correct data container") + assertEquals( + "<div style=\"display: flex; flex-direction: column;\"><div><span>First</span></div><div><span>Second</span></div></div>", + element?.innerHTML, + "Should render correct data container" + ) model.add(Model("Third")) - assertEquals("<div style=\"display: flex; flex-direction: column;\"><div><span>First</span></div><div><span>Second</span></div><div><span>Third</span></div></div>", element?.innerHTML, "Should render correct data container after model change") + assertEquals( + "<div style=\"display: flex; flex-direction: column;\"><div><span>First</span></div><div><span>Second</span></div><div><span>Third</span></div></div>", + element?.innerHTML, + "Should render correct data container after model change" + ) model[1].value = "Changed" - assertEquals("<div style=\"display: flex; flex-direction: column;\"><div><span>First</span></div><div><span>Changed</span></div><div><span>Third</span></div></div>", element?.innerHTML, "Should render correct data container after model element change") + assertEquals( + "<div style=\"display: flex; flex-direction: column;\"><div><span>First</span></div><div><span>Changed</span></div><div><span>Third</span></div></div>", + element?.innerHTML, + "Should render correct data container after model element change" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt index 6cfd948a..cd4f8930 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt @@ -20,7 +20,11 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals("<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>", element?.innerHTML, "Should render correct drop down") + assertEquals( + "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>", + element?.innerHTML, + "Should render correct drop down" + ) } } @@ -33,7 +37,11 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals("<div class=\"dropup\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>", element?.innerHTML, "Should render correct drop down") + assertEquals( + "<div class=\"dropup\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li><a href=\"#!/x\">abc</a></li><li><a href=\"#!/y\">def</a></li></ul></div>", + element?.innerHTML, + "Should render correct drop down" + ) } } @@ -46,7 +54,11 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals("<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li class=\"dropdown-header\">abc</li></ul></div>", element?.innerHTML, "Should render correct drop down") + assertEquals( + "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li class=\"dropdown-header\">abc</li></ul></div>", + element?.innerHTML, + "Should render correct drop down" + ) } } @@ -59,7 +71,11 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals("<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li class=\"divider\" role=\"separator\">abc</li></ul></div>", element?.innerHTML, "Should render correct drop down") + assertEquals( + "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li class=\"divider\" role=\"separator\">abc</li></ul></div>", + element?.innerHTML, + "Should render correct drop down" + ) } } @@ -72,7 +88,11 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals("<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li class=\"disabled\"><a href=\"#\">abc</a></li></ul></div>", element?.innerHTML, "Should render correct drop down") + assertEquals( + "<div class=\"dropdown\"><button class=\"dropdown btn btn-default\" id=\"$id\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"glyphicon glyphicon-flag\"></span> Dropdown</button><ul class=\"dropdown-menu\" aria-labelledby=\"$id\"><li class=\"disabled\"><a href=\"#\">abc</a></li></ul></div>", + element?.innerHTML, + "Should render correct drop down" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt index 9aa9328e..fa206efd 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt @@ -16,7 +16,11 @@ class FieldLabelSpec : DomSpec { val fl = FieldLabel("input", "Label") root.add(fl) val element = document.getElementById("test") - assertEquals("<label class=\"control-label\" for=\"input\">Label</label>", element?.innerHTML, "Should render correct label") + assertEquals( + "<label class=\"control-label\" for=\"input\">Label</label>", + element?.innerHTML, + "Should render correct label" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt index d325dc0f..1b8d2a6a 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt @@ -16,7 +16,11 @@ class HelpBlockSpec : DomSpec { val fl = HelpBlock("Form Error") root.add(fl) val element = document.getElementById("test") - assertEquals("<span class=\"help-block small\">Form Error</span>", element?.innerHTML, "Should render correct help block") + assertEquals( + "<span class=\"help-block small\">Form Error</span>", + element?.innerHTML, + "Should render correct help block" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt index f0cdc795..e049aa17 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt @@ -24,11 +24,19 @@ class CheckBoxSpec : DomSpec { root.add(ci) val element = document.getElementById("test") val id = ci.input.id - assertEquals("<div class=\"checkbox checkbox-danger checkbox-circle checkbox-inline\"><input class=\"styled\" id=\"$id\" type=\"checkbox\" checked=\"\" name=\"name\" disabled=\"\"><label for=\"$id\">Label</label></div>", element?.innerHTML, "Should render correct checkbox form control") + assertEquals( + "<div class=\"checkbox checkbox-danger checkbox-circle checkbox-inline\"><input class=\"styled\" id=\"$id\" type=\"checkbox\" checked=\"\" name=\"name\" disabled=\"\"><label for=\"$id\">Label</label></div>", + element?.innerHTML, + "Should render correct checkbox form control" + ) ci.style = CHECKBOXSTYLE.INFO ci.circled = false ci.inline = false - assertEquals("<div class=\"checkbox checkbox-info\"><input class=\"styled\" id=\"$id\" type=\"checkbox\" checked=\"\" name=\"name\" disabled=\"\"><label for=\"$id\">Label</label></div>", element?.innerHTML, "Should render correct checkbox form control") + assertEquals( + "<div class=\"checkbox checkbox-info\"><input class=\"styled\" id=\"$id\" type=\"checkbox\" checked=\"\" name=\"name\" disabled=\"\"><label for=\"$id\">Label</label></div>", + element?.innerHTML, + "Should render correct checkbox form control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt index 61b14a93..584b1232 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/CheckInputSpec.kt @@ -21,7 +21,11 @@ class CheckInputSpec : DomSpec { } root.add(ci) val element = document.getElementById("test") - assertEquals("<input id=\"idti\" type=\"checkbox\" checked=\"\" name=\"name\" disabled=\"\">", element?.innerHTML, "Should render correct checkbox control") + assertEquals( + "<input id=\"idti\" type=\"checkbox\" checked=\"\" name=\"name\" disabled=\"\">", + element?.innerHTML, + "Should render correct checkbox control" + ) } } @@ -36,7 +40,11 @@ class CheckInputSpec : DomSpec { } root.add(ci) val element = document.getElementById("test") - assertEquals("<input id=\"idti\" type=\"radio\" checked=\"\" name=\"name\" value=\"abc\">", element?.innerHTML, "Should render correct radio button control") + assertEquals( + "<input id=\"idti\" type=\"radio\" checked=\"\" name=\"name\" value=\"abc\">", + element?.innerHTML, + "Should render correct radio button control" + ) } } 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 index b1dc19ea..d301a533 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupSpec.kt @@ -23,7 +23,11 @@ class RadioGroupSpec : DomSpec { 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") + 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" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt index a2a87b0f..d32a84a3 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt @@ -23,11 +23,19 @@ class RadioSpec : DomSpec { root.add(ci) val element = document.getElementById("test") val id = ci.input.id - assertEquals("<div class=\"radio radio-danger radio-inline\"><input id=\"$id\" type=\"radio\" checked=\"\" name=\"name\" disabled=\"\" value=\"abc\"><label for=\"$id\">Label</label></div>", element?.innerHTML, "Should render correct radio button form control") + assertEquals( + "<div class=\"radio radio-danger radio-inline\"><input id=\"$id\" type=\"radio\" checked=\"\" name=\"name\" disabled=\"\" value=\"abc\"><label for=\"$id\">Label</label></div>", + element?.innerHTML, + "Should render correct radio button form control" + ) ci.style = RADIOSTYLE.INFO ci.squared = true ci.inline = false - assertEquals("<div class=\"checkbox checkbox-info\"><input id=\"$id\" type=\"radio\" checked=\"\" name=\"name\" disabled=\"\" value=\"abc\"><label for=\"$id\">Label</label></div>", element?.innerHTML, "Should render correct radio button form control") + assertEquals( + "<div class=\"checkbox checkbox-info\"><input id=\"$id\" type=\"radio\" checked=\"\" name=\"name\" disabled=\"\" value=\"abc\"><label for=\"$id\">Label</label></div>", + element?.innerHTML, + "Should render correct radio button form control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt index 4f3544b9..28f9eb03 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt @@ -22,7 +22,10 @@ class SelectInputSpec : DomSpec { } root.add(selectInput) val element = document.getElementById("test") - assertTrue(true == element?.innerHTML?.endsWith("<select class=\"selectpicker\" multiple=\"\" data-live-search=\"true\" title=\"Choose ...\" data-style=\"btn-default\" data-width=\"fit\" tabindex=\"-98\"><option value=\"#kvnull\"></option><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></select></div>"), "Should render correct select input") + assertTrue( + true == element?.innerHTML?.endsWith("<select class=\"selectpicker\" multiple=\"\" data-live-search=\"true\" title=\"Choose ...\" data-style=\"btn-default\" data-width=\"fit\" tabindex=\"-98\"><option value=\"#kvnull\"></option><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></select></div>"), + "Should render correct select input" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt index 90348f15..8562d3cc 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptGroupSpec.kt @@ -17,9 +17,17 @@ class SelectOptGroupSpec : DomSpec { val selectOptGroup = SelectOptGroup("Group", listOf("test1" to "Test 1", "test2" to "Test 2"), 2) root.add(selectOptGroup) val element = document.getElementById("test") - assertEquals("<optgroup label=\"Group\" data-max-options=\"2\"><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></optgroup>", element?.innerHTML, "Should render correct select option group") + assertEquals( + "<optgroup label=\"Group\" data-max-options=\"2\"><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></optgroup>", + element?.innerHTML, + "Should render correct select option group" + ) selectOptGroup.add(SelectOption("test3", "Test 3")) - assertEquals("<optgroup label=\"Group\" data-max-options=\"2\"><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option><option value=\"test3\">Test 3</option></optgroup>", element?.innerHTML, "Should render correct select option group with added option") + assertEquals( + "<optgroup label=\"Group\" data-max-options=\"2\"><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option><option value=\"test3\">Test 3</option></optgroup>", + element?.innerHTML, + "Should render correct select option group with added option" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt index 007db186..221d46b0 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt @@ -16,11 +16,23 @@ class SelectOptionSpec : DomSpec { val selectOption = SelectOption("testValue", "testLabel") root.add(selectOption) val element = document.getElementById("test") - assertEquals("<option value=\"testValue\">testLabel</option>", element?.innerHTML, "Should render correct select option") + assertEquals( + "<option value=\"testValue\">testLabel</option>", + element?.innerHTML, + "Should render correct select option" + ) selectOption.icon = "fa-flag" - assertEquals("<option value=\"testValue\" data-icon=\"fa fa-flag\">testLabel</option>", element?.innerHTML, "Should render correct select option with icon") + assertEquals( + "<option value=\"testValue\" data-icon=\"fa fa-flag\">testLabel</option>", + element?.innerHTML, + "Should render correct select option with icon" + ) selectOption.divider = true - assertEquals("<option data-divider=\"true\"></option>", element?.innerHTML, "Should render correct divider option") + assertEquals( + "<option data-divider=\"true\"></option>", + element?.innerHTML, + "Should render correct divider option" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt index 1c44e820..1afb6c79 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt @@ -23,8 +23,14 @@ class SelectSpec : DomSpec { root.add(select) val element = document.getElementById("test") val id = select.input.id - assertTrue(true == element?.innerHTML?.startsWith("<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label>"), "Should render correct select form control") - assertTrue(true == element?.innerHTML?.endsWith("<select class=\"form-control selectpicker\" id=\"$id\" multiple=\"\" data-live-search=\"true\" title=\"Choose ...\" data-style=\"btn-default\" data-width=\"fit\" tabindex=\"-98\"><option value=\"#kvnull\"></option><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></select></div></div>"), "Should render correct select form control") + assertTrue( + true == element?.innerHTML?.startsWith("<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label>"), + "Should render correct select form control" + ) + assertTrue( + true == element?.innerHTML?.endsWith("<select class=\"form-control selectpicker\" id=\"$id\" multiple=\"\" data-live-search=\"true\" title=\"Choose ...\" data-style=\"btn-default\" data-width=\"fit\" tabindex=\"-98\"><option value=\"#kvnull\"></option><option value=\"test1\">Test 1</option><option value=\"test2\">Test 2</option></select></div></div>"), + "Should render correct select form control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt index b800f297..8a7a346b 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt @@ -21,9 +21,17 @@ class SpinnerSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals("<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div></div>", element?.innerHTML, "Should render correct spinner input form control") + assertEquals( + "<div class=\"form-group\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div></div>", + element?.innerHTML, + "Should render correct spinner input form control" + ) ti.validatorError = "Validation Error" - assertEquals("<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div><span class=\"help-block small\">Validation Error</span></div>", element?.innerHTML, "Should render correct spinner input form control with validation error") + assertEquals( + "<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><div class=\"input-group kv-spinner-btn-vertical\"><span><div class=\"input-group bootstrap-touchspin\"><span class=\"input-group-addon bootstrap-touchspin-prefix\" style=\"display: none;\"></span><input class=\"form-control\" id=\"$id\" type=\"text\" value=\"13\" placeholder=\"place\" name=\"name\" disabled=\"\" style=\"display: block;\"><span class=\"input-group-addon bootstrap-touchspin-postfix\" style=\"display: none;\"></span><span class=\"input-group-btn-vertical\"><button class=\"btn btn-default bootstrap-touchspin-up\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-up\"></i></button><button class=\"btn btn-default bootstrap-touchspin-down\" type=\"button\"><i class=\"glyphicon glyphicon-chevron-down\"></i></button></span></div></span></div><span class=\"help-block small\">Validation Error</span></div>", + element?.innerHTML, + "Should render correct spinner input form control with validation error" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt index cdbbdd4e..1cbb29cc 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/PasswordSpec.kt @@ -22,7 +22,11 @@ class PasswordSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals("<div class=\"form-group\"><label class=\"control-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 control") + assertEquals( + "<div class=\"form-group\"><label class=\"control-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 control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt index 6910c4a2..92e0e9ff 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextInputSpec.kt @@ -21,7 +21,11 @@ class RichTextInputSpec : DomSpec { root.add(hai) val id = document.getElementById("test")?.let { jQuery(it).find("trix-editor").attr("trix-id") } ?: "0" val content = document.getElementById("test")?.let { jQuery(it).find("trix-editor")[0]?.outerHTML } - assertEquals("<trix-editor contenteditable=\"\" class=\"form-control trix-control\" id=\"idti\" placeholder=\"place\" trix-id=\"$id\" input=\"trix-input-$id\" toolbar=\"trix-toolbar-$id\"></trix-editor>", content, "Should render correct html area control") + assertEquals( + "<trix-editor contenteditable=\"\" class=\"form-control trix-control\" id=\"idti\" placeholder=\"place\" trix-id=\"$id\" input=\"trix-input-$id\" toolbar=\"trix-toolbar-$id\"></trix-editor>", + content, + "Should render correct html area control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt index ef7374df..28ce2ee7 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/RichTextSpec.kt @@ -22,9 +22,17 @@ class RichTextSpec : DomSpec { val id = document.getElementById("test")?.let { jQuery(it).find("trix-editor").attr("trix-id") } ?: "0" val iid = hai.input.id val content = document.getElementById("test")?.let { jQuery(it).find("trix-editor")[0]?.outerHTML } - assertEquals("<trix-editor contenteditable=\"\" class=\"form-control trix-control\" id=\"$iid\" placeholder=\"place\" trix-id=\"$id\" input=\"trix-input-$id\" toolbar=\"trix-toolbar-$id\"></trix-editor>", content, "Should render correct html area form control") + assertEquals( + "<trix-editor contenteditable=\"\" class=\"form-control trix-control\" id=\"$iid\" placeholder=\"place\" trix-id=\"$id\" input=\"trix-input-$id\" toolbar=\"trix-toolbar-$id\"></trix-editor>", + content, + "Should render correct html area form control" + ) val label = document.getElementById("test")?.let { jQuery(it).find("label")[0]?.outerHTML } - assertEquals("<label class=\"control-label\" for=\"$iid\">Field</label>", label, "Should render correct label for html area form control") + assertEquals( + "<label class=\"control-label\" for=\"$iid\">Field</label>", + label, + "Should render correct label for html area form control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt index f60e21cb..a27e959d 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaInputSpec.kt @@ -22,7 +22,11 @@ class TextAreaInputSpec : DomSpec { } 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 control") + 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 control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt index 1a3ff550..8f9cf639 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextAreaSpec.kt @@ -22,7 +22,11 @@ class TextAreaSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals("<div class=\"form-group\"><label class=\"control-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 control") + assertEquals( + "<div class=\"form-group\"><label class=\"control-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 control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt index a82a5681..a3402c45 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextInputSpec.kt @@ -23,7 +23,11 @@ class TextInputSpec : DomSpec { } root.add(ti) val element = document.getElementById("test") - assertEquals("<input class=\"form-control\" id=\"idti\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" type=\"password\" value=\"abc\">", element?.innerHTML, "Should render correct input control") + assertEquals( + "<input class=\"form-control\" id=\"idti\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" type=\"password\" value=\"abc\">", + element?.innerHTML, + "Should render correct input control" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt index 1e9a5b6c..77741f26 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/text/TextSpec.kt @@ -22,9 +22,17 @@ class TextSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals("<div class=\"form-group\"><label class=\"control-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 control") + assertEquals( + "<div class=\"form-group\"><label class=\"control-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 control" + ) ti.validatorError = "Validation Error" - assertEquals("<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" type=\"text\" value=\"abc\"><span class=\"help-block small\">Validation Error</span></div>", element?.innerHTML, "Should render correct input form control with validation error") + assertEquals( + "<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" placeholder=\"place\" name=\"name\" maxlength=\"15\" disabled=\"\" type=\"text\" value=\"abc\"><span class=\"help-block small\">Validation Error</span></div>", + element?.innerHTML, + "Should render correct input form control with validation error" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt index fe6c2b45..909c4928 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt @@ -21,7 +21,11 @@ class DateTimeInputSpec : DomSpec { } root.add(dti) val value = dti.getElementJQuery()?.`val`() - assertEquals(data.toStringF(dti.format), value, "Should render date time input with correctly formatted value") + assertEquals( + data.toStringF(dti.format), + value, + "Should render date time input with correctly formatted value" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt index 1a8665b1..8ac43174 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt @@ -25,9 +25,17 @@ class DateTimeSpec : DomSpec { val element = document.getElementById("test") val id = ti.input.id val datastr = data.toStringF(ti.format) - assertEquals("<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=\"\" value=\"$datastr\"></div>", element?.innerHTML, "Should render correct date time input form control") + assertEquals( + "<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=\"\" value=\"$datastr\"></div>", + element?.innerHTML, + "Should render correct date time input form control" + ) ti.validatorError = "Validation Error" - assertEquals("<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"text\" placeholder=\"place\" name=\"name\" disabled=\"\" value=\"$datastr\"><span class=\"help-block small\">Validation Error</span></div>", element?.innerHTML, "Should render correct date time input form control with validation error") + assertEquals( + "<div class=\"form-group has-error\"><label class=\"control-label\" for=\"$id\">Label</label><input class=\"form-control\" id=\"$id\" type=\"text\" placeholder=\"place\" name=\"name\" disabled=\"\" value=\"$datastr\"><span class=\"help-block small\">Validation Error</span></div>", + element?.innerHTML, + "Should render correct date time input form control with validation error" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt index a36beafa..eb573d4f 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/helpers/CloseIconSpec.kt @@ -16,7 +16,11 @@ class CloseIconSpec : DomSpec { val ci = CloseIcon() root.add(ci) val element = document.getElementById("test") - assertEquals("<button class=\"close\" type=\"button\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>", element?.innerHTML, "Should render correct close icon") + assertEquals( + "<button class=\"close\" type=\"button\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>", + element?.innerHTML, + "Should render correct close icon" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt index 681b3db3..77061f62 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt @@ -20,7 +20,11 @@ class ButtonSpec : DomSpec { button.block = true root.add(button) val element = document.getElementById("test") - assertEquals("<button class=\"btn btn-primary btn-lg btn-block\" type=\"button\"><i class=\"fa fa-bars fa-lg\"></i> Cancel</button>", element?.innerHTML, "Should render correct html button") + assertEquals( + "<button class=\"btn btn-primary btn-lg btn-block\" type=\"button\"><i class=\"fa fa-bars fa-lg\"></i> Cancel</button>", + element?.innerHTML, + "Should render correct html button" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt index ebf3aedb..8afa7317 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt @@ -19,7 +19,11 @@ class ImageSpec : DomSpec { val image = Image(res, "Image", true, IMAGESHAPE.ROUNDED, true) root.add(image) val element = document.getElementById("test") - assertEquals("<img class=\"img-responsive center-block img-rounded\" src=\"$res\" alt=\"Image\">", element?.innerHTML, "Should render correct html image") + assertEquals( + "<img class=\"img-responsive center-block img-rounded\" src=\"$res\" alt=\"Image\">", + element?.innerHTML, + "Should render correct html image" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt index 1f4b6d2c..0087f56a 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt @@ -16,7 +16,11 @@ class LinkSpec : DomSpec { val link = Link("Google", "http://www.google.com") root.add(link) val element = document.getElementById("test") - assertEquals("<a href=\"http://www.google.com\">Google</a>", element?.innerHTML, "Should render correct html link") + assertEquals( + "<a href=\"http://www.google.com\">Google</a>", + element?.innerHTML, + "Should render correct html link" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt index 48a13f6d..bdf1ca0f 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt @@ -19,7 +19,11 @@ class ListSpec : DomSpec { val list = ListTag(LIST.DL_HORIZ, listOf("a1", "a2", "b1", "b2")) root.add(list) val element = document.getElementById("test") - assertEquals("<dl class=\"dl-horizontal\"><dt>a1</dt><dd>a2</dd><dt>b1</dt><dd>b2</dd></dl>", element?.innerHTML, "Should render correct html list") + assertEquals( + "<dl class=\"dl-horizontal\"><dt>a1</dt><dd>a2</dd><dt>b1</dt><dd>b2</dd></dl>", + element?.innerHTML, + "Should render correct html list" + ) } } @@ -32,7 +36,11 @@ class ListSpec : DomSpec { list.add(Tag(TAG.DEL, "del")) root.add(list) val element = document.getElementById("test") - assertEquals("<ul><li><pre>pre</pre></li><li><del>del</del></li></ul>", element?.innerHTML, "Should render correct html list") + assertEquals( + "<ul><li><pre>pre</pre></li><li><del>del</del></li></ul>", + element?.innerHTML, + "Should render correct html list" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt index 8d6a19d1..9840ff3e 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt @@ -19,7 +19,11 @@ class TagSpec : DomSpec { val tag = Tag(TAG.H1, "This is <b>h1</b>", rich = false, align = ALIGN.CENTER) root.add(tag) val element = document.getElementById("test") - assertEquals("<h1 class=\"text-center\">This is <b>h1</b></h1>", element?.innerHTML, "Should render correct html tag") + assertEquals( + "<h1 class=\"text-center\">This is <b>h1</b></h1>", + element?.innerHTML, + "Should render correct html tag" + ) } } @@ -30,7 +34,11 @@ class TagSpec : DomSpec { val tag = Tag(TAG.H1, "This is <b>h1</b>", rich = true, align = ALIGN.RIGHT) root.add(tag) val element = document.getElementById("test") - assertEquals("<h1 class=\"text-right\"><span>This is <b>h1</b></span></h1>", element?.innerHTML, "Should render correct html tag") + assertEquals( + "<h1 class=\"text-right\"><span>This is <b>h1</b></span></h1>", + element?.innerHTML, + "Should render correct html tag" + ) } } @@ -43,7 +51,11 @@ class TagSpec : DomSpec { tag.add(Link("abc", "/x")) root.add(tag) val element = document.getElementById("test") - assertEquals("<p class=\"text-right\"><del>This is test</del><a href=\"/x\">abc</a></p>", element?.innerHTML, "Should render correct html tag with children") + assertEquals( + "<p class=\"text-right\"><del>This is test</del><a href=\"/x\">abc</a></p>", + element?.innerHTML, + "Should render correct html tag with children" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt index 328bbfca..15ca9b50 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt @@ -24,7 +24,11 @@ class AlertSpec : DomSpec { val body = document.getElementById("test")?.let { jQuery(it).find(".modal-body").html() } assertEquals("<span>Alert content</span>", body, "Should render alert window with correct content") val footer = document.getElementById("test")?.let { jQuery(it).find(".modal-footer").html() } - assertEquals("<button class=\"btn btn-primary\" type=\"button\"><span class=\"glyphicon glyphicon-ok\"></span> OK</button>", footer, "Should render alert window with correct footer") + assertEquals( + "<button class=\"btn btn-primary\" type=\"button\"><span class=\"glyphicon glyphicon-ok\"></span> OK</button>", + footer, + "Should render alert window with correct footer" + ) val button = document.getElementById("test")?.let { jQuery(it).find(".modal-footer").find("button") } button?.click() val alert2 = document.getElementById("test")?.let { jQuery(it).find(".modal")[0] } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt index 9e91be0a..0d3bbc72 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/ConfirmSpec.kt @@ -2,7 +2,6 @@ package test.pl.treksoft.kvision.modal import pl.treksoft.jquery.jQuery import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.modal.Alert import pl.treksoft.kvision.modal.Confirm import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt index 73754d60..a83bbc6a 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt @@ -23,7 +23,11 @@ class DockPanelSpec : DomSpec { dockPanel.add(Label("jkl"), SIDE.LEFT) dockPanel.add(Label("mno"), SIDE.CENTER) val element = document.getElementById("test") - assertEquals("<div><div style=\"display: flex; flex-direction: column; justify-content: space-between; align-items: stretch;\"><div style=\"order: 2;\"><div style=\"display: flex; justify-content: space-between; align-items: center;\"><div style=\"order: 3;\"><span>def</span></div><div style=\"order: 1;\"><span>jkl</span></div><div style=\"order: 2;\"><span>mno</span></div></div></div><div style=\"order: 1; align-self: center;\"><span>abc</span></div><div style=\"order: 3; align-self: center;\"><span>ghi</span></div></div></div>", element?.innerHTML, "Should render correct dock panel") + assertEquals( + "<div><div style=\"display: flex; flex-direction: column; justify-content: space-between; align-items: stretch;\"><div style=\"order: 2;\"><div style=\"display: flex; justify-content: space-between; align-items: center;\"><div style=\"order: 3;\"><span>def</span></div><div style=\"order: 1;\"><span>jkl</span></div><div style=\"order: 2;\"><span>mno</span></div></div></div><div style=\"order: 1; align-self: center;\"><span>abc</span></div><div style=\"order: 3; align-self: center;\"><span>ghi</span></div></div></div>", + element?.innerHTML, + "Should render correct dock panel" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt index 3f5885fa..e1c3d160 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt @@ -22,7 +22,11 @@ class FlexPanelSpec : DomSpec { flexPanel.add(Label("def"), 2) flexPanel.add(Label("ghi"), 3) val element = document.getElementById("test") - assertEquals("<div style=\"display: flex; flex-direction: row-reverse; justify-content: space-evenly;\"><div style=\"order: 1;\"><span>abc</span></div><div style=\"order: 2;\"><span>def</span></div><div style=\"order: 3;\"><span>ghi</span></div></div>", element?.innerHTML, "Should render correct flex panel") + assertEquals( + "<div style=\"display: flex; flex-direction: row-reverse; justify-content: space-evenly;\"><div style=\"order: 1;\"><span>abc</span></div><div style=\"order: 2;\"><span>def</span></div><div style=\"order: 3;\"><span>ghi</span></div></div>", + element?.innerHTML, + "Should render correct flex panel" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt index 547baafe..571f13e9 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt @@ -20,7 +20,11 @@ class GridPanelSpec : DomSpec { gridPanel.add(Label("def"), 2, 2) gridPanel.add(Label("ghi"), 3, 3) val element = document.getElementById("test") - assertEquals("<div style=\"display: grid;\"><div style=\"grid-column-start: 1; grid-row-start: 1;\"><span>abc</span></div><div style=\"grid-column-start: 2; grid-row-start: 2;\"><span>def</span></div><div style=\"grid-column-start: 3; grid-row-start: 3;\"><span>ghi</span></div></div>", element?.innerHTML, "Should render correct grid panel") + assertEquals( + "<div style=\"display: grid;\"><div style=\"grid-column-start: 1; grid-row-start: 1;\"><span>abc</span></div><div style=\"grid-column-start: 2; grid-row-start: 2;\"><span>def</span></div><div style=\"grid-column-start: 3; grid-row-start: 3;\"><span>ghi</span></div></div>", + element?.innerHTML, + "Should render correct grid panel" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt index 48449fc2..589bd9df 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt @@ -21,7 +21,11 @@ class HPanelSpec : DomSpec { hPanel.add(Label("def"), 2) hPanel.add(Label("ghi"), 3) val element = document.getElementById("test") - assertEquals("<div style=\"display: flex; justify-content: space-between;\"><div style=\"order: 1;\"><span>abc</span></div><div style=\"order: 2;\"><span>def</span></div><div style=\"order: 3;\"><span>ghi</span></div></div>", element?.innerHTML, "Should render correct horizontal panel") + assertEquals( + "<div style=\"display: flex; justify-content: space-between;\"><div style=\"order: 1;\"><span>abc</span></div><div style=\"order: 2;\"><span>def</span></div><div style=\"order: 3;\"><span>ghi</span></div></div>", + element?.innerHTML, + "Should render correct horizontal panel" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt index 5fb9376d..2bbb3774 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt @@ -20,7 +20,11 @@ class ResponsiveGridPanelSpec : DomSpec { rgPanel.add(Label("def"), 2, 2) rgPanel.add(Label("ghi"), 3, 3) val element = document.getElementById("test") - assertEquals("<div><div class=\"row\"></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>abc</span></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>def</span></div><div class=\"col-md-3\"></div></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>ghi</span></div></div></div>", element?.innerHTML, "Should render correct responsive grid panel") + assertEquals( + "<div><div class=\"row\"></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>abc</span></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>def</span></div><div class=\"col-md-3\"></div></div><div class=\"row\"><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"></div><div class=\"col-md-3\"><span>ghi</span></div></div></div>", + element?.innerHTML, + "Should render correct responsive grid panel" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt index e3442f59..0cce9bb5 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt @@ -1,17 +1,13 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.jquery.jQuery import pl.treksoft.kvision.basic.Label import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.modal.Alert import pl.treksoft.kvision.panel.DIRECTION import pl.treksoft.kvision.panel.SplitPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test import kotlin.test.assertEquals -import kotlin.test.assertNotNull -import kotlin.test.assertNull class SplitPanelSpec : DomSpec { @@ -27,7 +23,11 @@ class SplitPanelSpec : DomSpec { splitPanel.add(label2) val element = document.getElementById("test") val id = splitPanel.splitter.id - assertEquals("<div class=\"splitpanel-vertical\"><span class=\"resizable\">abc</span><div class=\"splitter-vertical\" id=\"$id\" style=\"touch-action: none;\"></div><span>def</span></div>", element?.innerHTML, "Should render correct split panel") + assertEquals( + "<div class=\"splitpanel-vertical\"><span class=\"resizable\">abc</span><div class=\"splitter-vertical\" id=\"$id\" style=\"touch-action: none;\"></div><span>def</span></div>", + element?.innerHTML, + "Should render correct split panel" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt index 9484c194..f9f3f68a 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt @@ -36,7 +36,11 @@ class StackPanelSpec : DomSpec { stackPanel.add(label1) stackPanel.add(label2) val element = document.getElementById("test") - assertEquals("<div><span>abc</span></div>", element?.innerHTML, "Should render correct stack panel with activateLast = false") + assertEquals( + "<div><span>abc</span></div>", + element?.innerHTML, + "Should render correct stack panel with activateLast = false" + ) } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt index 4a1f9652..eea5710e 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt @@ -21,7 +21,11 @@ class TabPanelSpec : DomSpec { tabs.addTab("ABC", label1) tabs.addTab("DEF", label2) val element = document.getElementById("test") - assertEquals("<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"active\"><a href=\"#\">ABC</a></li><li role=\"presentation\"><a href=\"#\">DEF</a></li></ul><div><span>abc</span></div></div>", element?.innerHTML, "Should render correct tabs") + assertEquals( + "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"active\"><a href=\"#\">ABC</a></li><li role=\"presentation\"><a href=\"#\">DEF</a></li></ul><div><span>abc</span></div></div>", + element?.innerHTML, + "Should render correct tabs" + ) } } @@ -37,7 +41,11 @@ class TabPanelSpec : DomSpec { tabs.addTab("DEF", label2) tabs.activeIndex = 1 val element = document.getElementById("test") - assertEquals("<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"\"><a href=\"#\">ABC</a></li><li role=\"presentation\" class=\"active\"><a href=\"#\">DEF</a></li></ul><div><span>def</span></div></div>", element?.innerHTML, "Should change selected tab") + assertEquals( + "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"\"><a href=\"#\">ABC</a></li><li role=\"presentation\" class=\"active\"><a href=\"#\">DEF</a></li></ul><div><span>def</span></div></div>", + element?.innerHTML, + "Should change selected tab" + ) } } @@ -54,7 +62,11 @@ class TabPanelSpec : DomSpec { tabs.activeIndex = 1 tabs.removeTab(1) val element = document.getElementById("test") - assertEquals("<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"active\"><a href=\"#\">ABC</a></li></ul><div><span>abc</span></div></div>", element?.innerHTML, "Should remove tab") + assertEquals( + "<div><ul class=\"nav nav-tabs\"><li role=\"presentation\" class=\"active\"><a href=\"#\">ABC</a></li></ul><div><span>abc</span></div></div>", + element?.innerHTML, + "Should remove tab" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt index a65b3ca9..26fb2675 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt @@ -21,7 +21,11 @@ class VPanelSpec : DomSpec { vPanel.add(Label("def"), 2) vPanel.add(Label("ghi"), 3) val element = document.getElementById("test") - assertEquals("<div style=\"display: flex; flex-direction: column; justify-content: space-between;\"><div style=\"order: 1;\"><span>abc</span></div><div style=\"order: 2;\"><span>def</span></div><div style=\"order: 3;\"><span>ghi</span></div></div>", element?.innerHTML, "Should render correct vertical panel") + assertEquals( + "<div style=\"display: flex; flex-direction: column; justify-content: space-between;\"><div style=\"order: 1;\"><span>abc</span></div><div style=\"order: 2;\"><span>def</span></div><div style=\"order: 3;\"><span>ghi</span></div></div>", + element?.innerHTML, + "Should render correct vertical panel" + ) } } }
\ No newline at end of file diff --git a/src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt index 3157affc..7ea011ef 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/utils/UtilsSpec.kt @@ -24,7 +24,11 @@ class UtilsSpec : SimpleSpec { fun toDateF() { run { val res = "2017-03-14 14:50:35".toDateF() - assertEquals(js("new Date(2017,2,14,14,50,35).getTime()"), res.getTime(), "Should convert String value to Date") + assertEquals( + js("new Date(2017,2,14,14,50,35).getTime()"), + res.getTime(), + "Should convert String value to Date" + ) } } @@ -35,15 +39,15 @@ class UtilsSpec : SimpleSpec { val res = Date().toStringF() val y = date.getFullYear() val m = date.getMonth() + 1 - val m2 = if (m<10) "0$m" else "$m" + val m2 = if (m < 10) "0$m" else "$m" val d = date.getDate() - val d2 = if (d<10) "0$d" else "$d" + val d2 = if (d < 10) "0$d" else "$d" val h = date.getHours() - val h2 = if (h<10) "0$h" else "$h" + val h2 = if (h < 10) "0$h" else "$h" val min = date.getMinutes() - val min2 = if (min<10) "0$min" else "$min" + val min2 = if (min < 10) "0$min" else "$min" val sec = date.getSeconds() - val sec2 = if (sec<10) "0$sec" else "$sec" + val sec2 = if (sec < 10) "0$sec" else "$sec" assertEquals("$y-$m2-$d2 $h2:$min2:$sec2", res, "Should convert Date value to String") } } |