From 238beca91b03634d56db656e8aa895153bdc1a33 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Mon, 26 Feb 2018 14:00:43 +0100 Subject: Unit tests compatibility with Firefox. --- src/main/kotlin/pl/treksoft/kvision/KVManager.kt | 6 ++++-- src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt | 16 ++++++++++++++++ .../test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt | 4 ++-- .../test/pl/treksoft/kvision/data/DataContainerSpec.kt | 11 +++++------ .../test/pl/treksoft/kvision/dropdown/DropDownSpec.kt | 11 +++++------ .../test/pl/treksoft/kvision/form/FieldLabelSpec.kt | 2 +- .../test/pl/treksoft/kvision/form/HelpBlockSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/form/check/CheckBoxSpec.kt | 9 ++++----- .../pl/treksoft/kvision/form/check/CheckInputSpec.kt | 9 ++++----- .../pl/treksoft/kvision/form/check/RadioGroupSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/form/check/RadioSpec.kt | 9 ++++----- .../treksoft/kvision/form/select/SelectOptGroupSpec.kt | 7 +++---- .../pl/treksoft/kvision/form/select/SelectOptionSpec.kt | 9 ++++----- .../test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt | 6 +++--- .../test/pl/treksoft/kvision/form/text/PasswordSpec.kt | 5 ++--- .../pl/treksoft/kvision/form/text/RichTextInputSpec.kt | 10 ++++------ .../test/pl/treksoft/kvision/form/text/RichTextSpec.kt | 12 +++++------- .../pl/treksoft/kvision/form/text/TextAreaInputSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/form/text/TextAreaSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/form/text/TextInputSpec.kt | 7 +++---- .../test/pl/treksoft/kvision/form/text/TextSpec.kt | 7 +++---- .../test/pl/treksoft/kvision/form/time/DateTimeSpec.kt | 7 +++---- .../kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt | 7 +++---- .../kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt | 7 +++---- .../kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt | 5 ++--- .../kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt | 5 ++--- .../kotlin/test/pl/treksoft/kvision/html/ListSpec.kt | 9 ++++----- src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt | 9 ++++----- .../kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt | 4 ++-- .../test/pl/treksoft/kvision/modal/CloseIconSpec.kt | 3 +-- .../test/pl/treksoft/kvision/panel/DockPanelSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/panel/FlexPanelSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/panel/GridPanelSpec.kt | 7 +++---- .../kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt | 5 ++--- .../pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/panel/SplitPanelSpec.kt | 5 ++--- .../test/pl/treksoft/kvision/panel/StackPanelSpec.kt | 9 ++++----- .../test/pl/treksoft/kvision/panel/TabPanelSpec.kt | 7 +++---- .../kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt | 5 ++--- 39 files changed, 126 insertions(+), 143 deletions(-) (limited to 'src') diff --git a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt index d3001b1d..4ab7c1d0 100644 --- a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt +++ b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt @@ -143,8 +143,10 @@ internal object KVManager { @Suppress("UnsafeCastFromDynamic") internal fun clearResizeEvent(component: Component) { - component.getElement()?.let { - elementResizeEvent.unbind(it) + if (component.getElement().asDynamic().__resizeTrigger__.contentDocument != null) { + component.getElement()?.let { + elementResizeEvent.unbind(it) + } } } } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt index 56a33690..b67ab307 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt @@ -26,6 +26,8 @@ import pl.treksoft.jquery.jQuery import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.panel.Root import kotlin.browser.document +import kotlin.test.assertEquals +import kotlin.test.assertTrue interface TestSpec { fun beforeTest() @@ -63,6 +65,20 @@ interface DomSpec : TestSpec { jQuery(`object` = ".modal-backdrop").remove() } + fun assertEqualsHtml(expected: String?, actual: String?, message: String?) { + if (expected != null && actual != null) { + val exp = jQuery(html = expected) + val act = jQuery(html = actual) + val result = exp[0]?.isEqualNode(act[0]) + if (result == true) { + assertTrue(result == true, message) + } else { + assertEquals(expected, actual, message) + } + } else { + assertEquals(expected, actual, message) + } + } } interface WSpec : DomSpec { 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 ff224b99..e2e6ef70 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/core/WidgetWrapperSpec.kt @@ -21,10 +21,10 @@ */ package test.pl.treksoft.kvision.core -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.core.UNIT import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.core.WidgetWrapper +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test @@ -41,7 +41,7 @@ class WidgetWrapperSpec : DomSpec { wrapper.width = 100 to UNIT.em root.add(wrapper) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render widget inside custom wrapper" 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 39d58f26..809f5880 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt @@ -22,14 +22,13 @@ package test.pl.treksoft.kvision.data import com.lightningkite.kotlin.observable.list.observableListOf -import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.data.BaseDataComponent import pl.treksoft.kvision.data.DataContainer +import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class DataContainerSpec : DomSpec { @@ -46,19 +45,19 @@ class DataContainerSpec : DomSpec { val container = DataContainer(model, { index -> Label(model[index].value) }) root.add(container) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
First
Second
", element?.innerHTML, "Should render correct data container" ) model.add(Model("Third")) - assertEquals( + assertEqualsHtml( "
First
Second
Third
", element?.innerHTML, "Should render correct data container after model change" ) model[1].value = "Changed" - assertEquals( + assertEqualsHtml( "
First
Changed
Third
", 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 a86a7e12..4d1b9334 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt @@ -27,7 +27,6 @@ import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals import kotlin.test.assertTrue class DropDownSpec : DomSpec { @@ -41,7 +40,7 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct drop down" @@ -58,7 +57,7 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct drop down" @@ -75,7 +74,7 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct drop down" @@ -92,7 +91,7 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct drop down" @@ -109,7 +108,7 @@ class DropDownSpec : DomSpec { dd.toggle() val element = document.getElementById("test") val id = dd.button.id - assertEquals( + assertEqualsHtml( "
", 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 c818d5fd..fbbfd5bb 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/FieldLabelSpec.kt @@ -37,7 +37,7 @@ class FieldLabelSpec : DomSpec { val fl = FieldLabel("input", "Label") root.add(fl) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", 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 d8a142a4..69e7b8df 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpBlockSpec.kt @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.form -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.HelpBlock +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class HelpBlockSpec : DomSpec { @@ -37,7 +36,7 @@ class HelpBlockSpec : DomSpec { val fl = HelpBlock("Form Error") root.add(fl) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "Form Error", 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 752bb378..95d53b3b 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 @@ -21,13 +21,12 @@ */ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.form.check.CheckBoxStyle import pl.treksoft.kvision.form.check.CheckBox +import pl.treksoft.kvision.form.check.CheckBoxStyle +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class CheckBoxSpec : DomSpec { @@ -45,7 +44,7 @@ class CheckBoxSpec : DomSpec { root.add(ci) val element = document.getElementById("test") val id = ci.input.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct checkbox form control" @@ -53,7 +52,7 @@ class CheckBoxSpec : DomSpec { ci.style = CheckBoxStyle.INFO ci.circled = false ci.inline = false - assertEquals( + assertEqualsHtml( "
", 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 eeea3052..6b163047 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,13 +21,12 @@ */ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.form.check.CheckInputType import pl.treksoft.kvision.form.check.CheckInput +import pl.treksoft.kvision.form.check.CheckInputType +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class CheckInputSpec : DomSpec { @@ -42,7 +41,7 @@ class CheckInputSpec : DomSpec { } root.add(ci) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", element?.innerHTML, "Should render correct checkbox control" @@ -61,7 +60,7 @@ class CheckInputSpec : DomSpec { } root.add(ci) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", 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 62b10f68..21a9bf41 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 @@ -21,13 +21,12 @@ */ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.check.Radio import pl.treksoft.kvision.form.check.RadioGroup +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class RadioGroupSpec : DomSpec { @@ -44,7 +43,7 @@ class RadioGroupSpec : DomSpec { val id = ci.flabel.forId val rid1 = ci.getChildren().filterIsInstance().first().input.id val rid2 = ci.getChildren().filterIsInstance().last().input.id - assertEquals( + assertEqualsHtml( "
", 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 d0e72dea..b43c2caa 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 @@ -21,13 +21,12 @@ */ package test.pl.treksoft.kvision.form.check -import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.form.check.RadioStyle import pl.treksoft.kvision.form.check.Radio +import pl.treksoft.kvision.form.check.RadioStyle +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class RadioSpec : DomSpec { @@ -44,7 +43,7 @@ class RadioSpec : DomSpec { root.add(ci) val element = document.getElementById("test") val id = ci.input.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct radio button form control" @@ -52,7 +51,7 @@ class RadioSpec : DomSpec { ci.style = RadioStyle.INFO ci.squared = true ci.inline = false - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct radio button form control" 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 d9e2cad8..b906d09e 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 @@ -21,13 +21,12 @@ */ package test.pl.treksoft.kvision.form.select -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.select.SelectOptGroup import pl.treksoft.kvision.form.select.SelectOption +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class SelectOptGroupSpec : DomSpec { @@ -38,13 +37,13 @@ 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( + assertEqualsHtml( "", element?.innerHTML, "Should render correct select option group" ) selectOptGroup.add(SelectOption("test3", "Test 3")) - assertEquals( + assertEqualsHtml( "", 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 32080874..bbdfcd61 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 @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.form.select -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.select.SelectOption +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class SelectOptionSpec : DomSpec { @@ -37,19 +36,19 @@ class SelectOptionSpec : DomSpec { val selectOption = SelectOption("testValue", "testLabel") root.add(selectOption) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", element?.innerHTML, "Should render correct select option" ) selectOption.icon = "fa-flag" - assertEquals( + assertEqualsHtml( "", element?.innerHTML, "Should render correct select option with icon" ) selectOption.divider = true - assertEquals( + assertEqualsHtml( "", element?.innerHTML, "Should render correct divider option" 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 a8474790..fe2424f4 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,8 +21,8 @@ */ package test.pl.treksoft.kvision.form.spinner -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.spinner.Spinner +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test @@ -42,13 +42,13 @@ class SpinnerSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct spinner input form control" ) ti.validatorError = "Validation Error" - assertEquals( + assertEqualsHtml( "
Validation Error
", 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 f30111b1..3d1a90b7 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 @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.Password +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class PasswordSpec : DomSpec { @@ -43,7 +42,7 @@ class PasswordSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals( + assertEqualsHtml( "
", 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 60ba8b81..e94af8d4 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 @@ -22,12 +22,12 @@ package test.pl.treksoft.kvision.form.text import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.RichTextInput +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals +import kotlin.test.assertTrue class RichTextInputSpec : DomSpec { @@ -40,11 +40,9 @@ class RichTextInputSpec : DomSpec { id = "idti" } 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( - "", - content, + assertTrue( + content?.startsWith("", - content, + assertTrue( + content?.startsWith("Field", 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 ff7ed0b0..ac2aba28 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 @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.TextAreaInput +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class TextAreaInputSpec : DomSpec { @@ -43,7 +42,7 @@ class TextAreaInputSpec : DomSpec { } root.add(ti) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", 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 1b34f7d2..8ee0a0f9 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 @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.TextArea +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class TextAreaSpec : DomSpec { @@ -43,7 +42,7 @@ class TextAreaSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals( + assertEqualsHtml( "
", 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 8b743a6a..4ceefc16 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 @@ -21,13 +21,12 @@ */ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.form.text.TextInputType import pl.treksoft.kvision.form.text.TextInput +import pl.treksoft.kvision.form.text.TextInputType +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class TextInputSpec : DomSpec { @@ -44,7 +43,7 @@ class TextInputSpec : DomSpec { } root.add(ti) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", 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 baa2b20f..5ee99907 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 @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.form.text -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.text.Text +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class TextSpec : DomSpec { @@ -43,13 +42,13 @@ class TextSpec : DomSpec { root.add(ti) val element = document.getElementById("test") val id = ti.input.id - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct input form control" ) ti.validatorError = "Validation Error" - assertEquals( + assertEqualsHtml( "
Validation Error
", element?.innerHTML, "Should render correct input form control with validation error" 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 fa158b68..ba4ed7cf 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 @@ -21,14 +21,13 @@ */ package test.pl.treksoft.kvision.form.time -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.form.time.DateTime +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.utils.toStringF import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.js.Date import kotlin.test.Test -import kotlin.test.assertEquals class DateTimeSpec : DomSpec { @@ -46,13 +45,13 @@ class DateTimeSpec : DomSpec { val element = document.getElementById("test") val id = ti.input.id val datastr = data.toStringF(ti.format) - assertEquals( + assertEqualsHtml( "
", element?.innerHTML, "Should render correct date time input form control" ) ti.validatorError = "Validation Error" - assertEquals( + assertEqualsHtml( "
Validation Error
", element?.innerHTML, "Should render correct date time input form control with validation error" 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 d70d28e2..9c989156 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt @@ -21,14 +21,13 @@ */ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.panel.Root +import pl.treksoft.kvision.html.Button import pl.treksoft.kvision.html.ButtonSize import pl.treksoft.kvision.html.ButtonStyle -import pl.treksoft.kvision.html.Button +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class ButtonSpec : DomSpec { @@ -41,7 +40,7 @@ class ButtonSpec : DomSpec { button.block = true root.add(button) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", 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 ebc6546d..be53c128 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt @@ -21,14 +21,13 @@ */ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.html.ImageShape import pl.treksoft.kvision.html.Image +import pl.treksoft.kvision.html.ImageShape +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import test.pl.treksoft.kvision.require import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class ImageSpec : DomSpec { @@ -41,7 +40,7 @@ class ImageSpec : DomSpec { val image = Image(res, "Image", true, ImageShape.ROUNDED, true) root.add(image) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "\"Image\"", element?.innerHTML, "Should render correct html image" diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt index 0a7482b3..99f1b01c 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.Label +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class LabelSpec : DomSpec { @@ -37,7 +36,7 @@ class LabelSpec : DomSpec { val label = Label("This is a label") root.add(label) val element = document.getElementById("test") - assertEquals("This is a label", element?.innerHTML, "Should render correct label") + assertEqualsHtml("This is a label", element?.innerHTML, "Should render correct label") } } 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 c1bf0ac1..4e3dec2d 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LinkSpec.kt @@ -21,12 +21,11 @@ */ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.Link +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class LinkSpec : DomSpec { @@ -37,7 +36,7 @@ class LinkSpec : DomSpec { val link = Link("Google", "http://www.google.com") root.add(link) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "Google", 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 8a8def6d..b691ab1a 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ListSpec.kt @@ -21,15 +21,14 @@ */ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.html.ListType import pl.treksoft.kvision.html.ListTag +import pl.treksoft.kvision.html.ListType import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class ListSpec : DomSpec { @@ -40,7 +39,7 @@ class ListSpec : DomSpec { val list = ListTag(ListType.DL_HORIZ, listOf("a1", "a2", "b1", "b2")) root.add(list) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
a1
a2
b1
b2
", element?.innerHTML, "Should render correct html list" @@ -57,7 +56,7 @@ class ListSpec : DomSpec { list.add(Tag(TAG.DEL, "del")) root.add(list) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
  • pre
  • del
", 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 3bccaa20..4ef79069 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/TagSpec.kt @@ -21,15 +21,14 @@ */ package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.html.Align import pl.treksoft.kvision.html.Link import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class TagSpec : DomSpec { @@ -40,7 +39,7 @@ class TagSpec : DomSpec { val tag = Tag(TAG.H1, "This is h1", rich = false, align = Align.CENTER) root.add(tag) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "

This is <b>h1</b>

", element?.innerHTML, "Should render correct html tag" @@ -55,7 +54,7 @@ class TagSpec : DomSpec { val tag = Tag(TAG.H1, "This is h1", rich = true, align = Align.RIGHT) root.add(tag) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "

This is h1

", element?.innerHTML, "Should render correct html tag" @@ -72,7 +71,7 @@ class TagSpec : DomSpec { tag.add(Link("abc", "/x")) root.add(tag) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "

This is testabc

", element?.innerHTML, "Should render correct html tag with children" 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 fa9445d3..8f6e79bc 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt @@ -22,8 +22,8 @@ package test.pl.treksoft.kvision.modal import pl.treksoft.jquery.jQuery -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.modal.Alert +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test @@ -45,7 +45,7 @@ class AlertSpec : DomSpec { val body = document.getElementById("test")?.let { jQuery(it).find(".modal-body").html() } assertEquals("
Alert content
", body, "Should render alert window with correct content") val footer = document.getElementById("test")?.let { jQuery(it).find(".modal-footer").html() } - assertEquals( + assertEqualsHtml( "", footer, "Should render alert window with correct footer" diff --git a/src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt index 2be15cae..49e359a7 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/modal/CloseIconSpec.kt @@ -26,7 +26,6 @@ import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class CloseIconSpec : DomSpec { @@ -37,7 +36,7 @@ class CloseIconSpec : DomSpec { val ci = CloseIcon() root.add(ci) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", element?.innerHTML, "Should render correct close icon" 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 9dd21892..1eff4042 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt @@ -22,13 +22,12 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.DockPanel +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.Side import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class DockPanelSpec : DomSpec { @@ -44,7 +43,7 @@ class DockPanelSpec : DomSpec { dockPanel.add(Label("jkl"), Side.LEFT) dockPanel.add(Label("mno"), Side.CENTER) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
def
jkl
mno
abc
ghi
", element?.innerHTML, "Should render correct dock panel" 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 9fd0f5e9..60012891 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt @@ -22,14 +22,13 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.FlexDir import pl.treksoft.kvision.panel.FlexJustify import pl.treksoft.kvision.panel.FlexPanel +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class FlexPanelSpec : DomSpec { @@ -43,7 +42,7 @@ class FlexPanelSpec : DomSpec { flexPanel.add(Label("def"), 2) flexPanel.add(Label("ghi"), 3) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
abc
def
ghi
", element?.innerHTML, "Should render correct flex panel" 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 34f7931d..e59f0977 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt @@ -22,12 +22,11 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.GridPanel +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class GridPanelSpec : DomSpec { @@ -41,9 +40,9 @@ class GridPanelSpec : DomSpec { gridPanel.add(Label("def"), 2, 2) gridPanel.add(Label("ghi"), 3, 3) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
abc
def
ghi
", - element?.innerHTML, + element?.innerHTML?.replace(" ", " "), "Should render correct grid panel" ) } 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 4ae3f1d5..192be8b7 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt @@ -22,13 +22,12 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.FlexJustify import pl.treksoft.kvision.panel.HPanel +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class HPanelSpec : DomSpec { @@ -42,7 +41,7 @@ class HPanelSpec : DomSpec { hPanel.add(Label("def"), 2) hPanel.add(Label("ghi"), 3) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
abc
def
ghi
", element?.innerHTML, "Should render correct horizontal panel" 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 2853a583..03af514b 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt @@ -22,12 +22,11 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.ResponsiveGridPanel +import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class ResponsiveGridPanelSpec : DomSpec { @@ -41,7 +40,7 @@ class ResponsiveGridPanelSpec : DomSpec { rgPanel.add(Label("def"), 2, 2) rgPanel.add(Label("ghi"), 3, 3) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
abc
def
ghi
", element?.innerHTML, "Should render correct responsive grid panel" 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 d270ea2b..65fee217 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt @@ -22,13 +22,12 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.Direction +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.SplitPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class SplitPanelSpec : DomSpec { @@ -44,7 +43,7 @@ class SplitPanelSpec : DomSpec { splitPanel.add(label2) val element = document.getElementById("test") val id = splitPanel.splitter.id - assertEquals( + assertEqualsHtml( "
abc
def
", element?.innerHTML, "Should render correct split panel" 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 55eb2cbb..17e5b40f 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt @@ -27,7 +27,6 @@ import pl.treksoft.kvision.panel.StackPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class StackPanelSpec : DomSpec { @@ -42,7 +41,7 @@ class StackPanelSpec : DomSpec { stackPanel.add(label1) stackPanel.add(label2) val element = document.getElementById("test") - assertEquals("
def
", element?.innerHTML, "Should render correct stack panel") + assertEqualsHtml("
def
", element?.innerHTML, "Should render correct stack panel") } } @@ -57,7 +56,7 @@ class StackPanelSpec : DomSpec { stackPanel.add(label1) stackPanel.add(label2) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
abc
", element?.innerHTML, "Should render correct stack panel with activateLast = false" @@ -77,7 +76,7 @@ class StackPanelSpec : DomSpec { stackPanel.add(label2) stackPanel.remove(label1) val element = document.getElementById("test") - assertEquals("
def
", element?.innerHTML, "Should remove correct child widget") + assertEqualsHtml("
def
", element?.innerHTML, "Should remove correct child widget") } } @@ -93,7 +92,7 @@ class StackPanelSpec : DomSpec { stackPanel.add(label2) stackPanel.removeAll() val element = document.getElementById("test") - assertEquals("
", element?.innerHTML, "Should remove all child widgets") + assertEqualsHtml("
", element?.innerHTML, "Should remove all child widgets") } } } \ No newline at end of file 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 a53cfada..78022db8 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt @@ -27,7 +27,6 @@ import pl.treksoft.kvision.panel.TabPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class TabPanelSpec : DomSpec { @@ -42,7 +41,7 @@ class TabPanelSpec : DomSpec { tabs.addTab("ABC", label1) tabs.addTab("DEF", label2) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", element?.innerHTML, "Should render correct tabs" @@ -62,7 +61,7 @@ class TabPanelSpec : DomSpec { tabs.addTab("DEF", label2) tabs.activeIndex = 1 val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "", element?.innerHTML, "Should change selected tab" @@ -83,7 +82,7 @@ class TabPanelSpec : DomSpec { tabs.activeIndex = 1 tabs.removeTab(1) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
abc
", element?.innerHTML, "Should remove tab" 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 9278d46c..eeaf5358 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt @@ -22,13 +22,12 @@ package test.pl.treksoft.kvision.panel import pl.treksoft.kvision.html.Label -import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.FlexJustify +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.VPanel import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -import kotlin.test.assertEquals class VPanelSpec : DomSpec { @@ -42,7 +41,7 @@ class VPanelSpec : DomSpec { vPanel.add(Label("def"), 2) vPanel.add(Label("ghi"), 3) val element = document.getElementById("test") - assertEquals( + assertEqualsHtml( "
abc
def
ghi
", element?.innerHTML, "Should render correct vertical panel" -- cgit