From 22a8d5c35db97d65a90b21d97e6835380191845d Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Wed, 25 Sep 2019 22:14:22 +0200 Subject: Upgrade Bootstrap to version 4 --- kvision-modules/kvision-redux-kotlin/build.gradle | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'kvision-modules/kvision-redux-kotlin') diff --git a/kvision-modules/kvision-redux-kotlin/build.gradle b/kvision-modules/kvision-redux-kotlin/build.gradle index 78bfda21..0b00ddd8 100644 --- a/kvision-modules/kvision-redux-kotlin/build.gradle +++ b/kvision-modules/kvision-redux-kotlin/build.gradle @@ -4,14 +4,3 @@ dependencies { compile ("org.reduxkotlin:redux-kotlin-js:$reduxKotlinVersion") compile ("org.reduxkotlin:redux-kotlin-thunk-js:$reduxKotlinThunkVersion") } - -kotlinFrontend { - - npm { - devDependency("karma", "3.1.4") - devDependency("karma-chrome-launcher", "2.2.0") - devDependency("karma-webpack", "3.0.5") - devDependency("qunit", "2.8.0") - } - -} -- cgit From 6b14906f0e35dc522bd1c1a44682d728315cf619 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 6 Oct 2019 20:38:07 +0200 Subject: Update all tests. --- kvision-modules/kvision-bootstrap-css/build.gradle | 8 ++++-- .../pl/treksoft/kvision/form/time/DateTimeInput.kt | 3 ++- .../kvision/form/time/DateTimeInputSpec.kt | 8 +++--- .../pl/treksoft/kvision/form/time/DateTimeSpec.kt | 4 +-- .../webpack.config.d/css.js | 2 ++ .../webpack.config.d/css.js | 2 ++ .../kvision/form/select/SelectInputSpec.kt | 2 +- .../kvision/form/select/SelectOptionSpec.kt | 4 +-- .../pl/treksoft/kvision/form/select/SelectSpec.kt | 6 +---- .../webpack.config.d/jquery.js | 5 ++++ .../treksoft/kvision/form/spinner/SpinnerSpec.kt | 4 +-- .../webpack.config.d/jquery.js | 5 ++++ kvision-modules/kvision-bootstrap/build.gradle | 1 + .../kotlin/test/pl/treksoft/kvision/TestUtil.kt | 4 +-- .../treksoft/kvision/dropdown/ContextMenuSpec.kt | 5 ++-- .../pl/treksoft/kvision/dropdown/DropDownSpec.kt | 29 +++++++++++----------- .../pl/treksoft/kvision/dropdown/HeaderSpec.kt | 2 +- .../pl/treksoft/kvision/dropdown/SeparatorSpec.kt | 2 +- .../test/pl/treksoft/kvision/modal/AlertSpec.kt | 16 ++++++------ .../test/pl/treksoft/kvision/navbar/NavFormSpec.kt | 4 +-- .../test/pl/treksoft/kvision/navbar/NavSpec.kt | 4 +-- .../test/pl/treksoft/kvision/navbar/NavbarSpec.kt | 11 ++++---- .../kvision/panel/ResponsiveGridPanelSpec.kt | 2 +- .../test/pl/treksoft/kvision/panel/TabPanelSpec.kt | 10 ++++---- .../pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt | 7 +++--- .../test/pl/treksoft/kvision/window/WindowSpec.kt | 11 +++----- .../kvision-chart/webpack.config.d/css.js | 2 ++ .../kvision-cordova/webpack.config.d/css.js | 2 ++ .../kvision-datacontainer/webpack.config.d/css.js | 2 ++ .../kvision-i18n/webpack.config.d/css.js | 2 ++ .../kvision-redux-kotlin/webpack.config.d/css.js | 2 ++ .../kvision-redux/webpack.config.d/css.js | 2 ++ .../kvision-richtext/webpack.config.d/jquery.js | 5 ++++ .../webpack.config.d/css.js | 2 ++ .../test/pl/treksoft/kvision/form/HelpTextSpec.kt | 4 +-- .../pl/treksoft/kvision/form/check/CheckBoxSpec.kt | 4 +-- .../kvision/form/check/RadioGroupInputSpec.kt | 2 +- .../treksoft/kvision/form/check/RadioGroupSpec.kt | 6 ++--- .../pl/treksoft/kvision/form/check/RadioSpec.kt | 4 +-- .../test/pl/treksoft/kvision/form/text/TextSpec.kt | 2 +- .../test/pl/treksoft/kvision/html/ButtonSpec.kt | 4 +-- .../test/pl/treksoft/kvision/html/IconSpec.kt | 4 +-- .../test/pl/treksoft/kvision/html/ImageSpec.kt | 2 +- .../test/pl/treksoft/kvision/table/TableSpec.kt | 4 +-- 44 files changed, 125 insertions(+), 91 deletions(-) create mode 100644 kvision-modules/kvision-bootstrap-dialog/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js create mode 100644 kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js create mode 100644 kvision-modules/kvision-chart/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-cordova/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-datacontainer/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-i18n/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-redux-kotlin/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-redux/webpack.config.d/css.js create mode 100644 kvision-modules/kvision-richtext/webpack.config.d/jquery.js create mode 100644 kvision-modules/kvision-tabulator-remote/webpack.config.d/css.js (limited to 'kvision-modules/kvision-redux-kotlin') diff --git a/kvision-modules/kvision-bootstrap-css/build.gradle b/kvision-modules/kvision-bootstrap-css/build.gradle index 0d47049b..1aca3288 100644 --- a/kvision-modules/kvision-bootstrap-css/build.gradle +++ b/kvision-modules/kvision-bootstrap-css/build.gradle @@ -1,5 +1,9 @@ apply from: "../shared.gradle" -dependencies { - compile project(":kvision-modules:kvision-bootstrap") +kotlinFrontend { + + npm { + dependency("bootstrap", "4.3.1") + } + } diff --git a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt index e0da98f8..626346b1 100644 --- a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt +++ b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt @@ -241,7 +241,8 @@ open class DateTimeInput( override fun afterDestroy() { if (initialized) { - getElementJQueryD()?.data("DateTimePicker").destroy() + val comp = getElementJQueryD()?.data("DateTimePicker") + if (comp != null) comp.destroy() initialized = false } } diff --git a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt index 877cf650..5cdb68c9 100644 --- a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt +++ b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt @@ -25,6 +25,7 @@ import pl.treksoft.kvision.form.time.DateTimeInput import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.types.toStringF import test.pl.treksoft.kvision.DomSpec +import kotlin.browser.document import kotlin.js.Date import kotlin.test.Test import kotlin.test.assertEquals @@ -41,10 +42,11 @@ class DateTimeInputSpec : DomSpec { id = "idti" } root.add(dti) - val value = dti.getElementJQuery()?.`val`() + val element = document.getElementById("test") + val datastr = data.toStringF(dti.format) assertEquals( - data.toStringF(dti.format), - value, + "
", + element?.innerHTML, "Should render date time input with correctly formatted value" ) } diff --git a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt index eba3ef74..a6714f0c 100644 --- a/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt +++ b/kvision-modules/kvision-bootstrap-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt @@ -46,13 +46,13 @@ class DateTimeSpec : DomSpec { val id = ti.input.id val datastr = data.toStringF(ti.format) assertEqualsHtml( - "
", + "
", element?.innerHTML, "Should render correct date time input form control" ) ti.validatorError = "Validation Error" assertEqualsHtml( - "
Validation Error
", + "
Validation Error
", element?.innerHTML, "Should render correct date time input form control with validation error" ) diff --git a/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/css.js b/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-bootstrap-dialog/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/css.js b/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-bootstrap-select-remote/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt b/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt index bfd93900..0e759896 100644 --- a/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt +++ b/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectInputSpec.kt @@ -44,7 +44,7 @@ class SelectInputSpec : DomSpec { root.add(selectInput) val element = document.getElementById("test") assertTrue( - true == element?.innerHTML?.endsWith(""), + true == element?.innerHTML?.startsWith("
"), "Should render correct select input" ) } diff --git a/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt b/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt index 33c36576..d711301a 100644 --- a/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt +++ b/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectOptionSpec.kt @@ -41,9 +41,9 @@ class SelectOptionSpec : DomSpec { element?.innerHTML, "Should render correct select option" ) - selectOption.icon = "fa-flag" + selectOption.icon = "fas fa-flag" assertEqualsHtml( - "", + "", element?.innerHTML, "Should render correct select option with icon" ) diff --git a/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt b/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt index 9eddff81..9ed44f82 100644 --- a/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt +++ b/kvision-modules/kvision-bootstrap-select/src/test/kotlin/test/pl/treksoft/kvision/form/select/SelectSpec.kt @@ -45,11 +45,7 @@ class SelectSpec : DomSpec { val element = document.getElementById("test") val id = select.input.id assertTrue( - true == element?.innerHTML?.startsWith("
"), - "Should render correct select form control" - ) - assertTrue( - true == element?.innerHTML?.endsWith("
"), + true == element?.innerHTML?.startsWith("
"), "Should render correct select form control" ) } diff --git a/kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js new file mode 100644 index 00000000..bf5a1a20 --- /dev/null +++ b/kvision-modules/kvision-bootstrap-select/webpack.config.d/jquery.js @@ -0,0 +1,5 @@ +config.plugins.push(new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery", + "window.jQuery": "jquery" +})); diff --git a/kvision-modules/kvision-bootstrap-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt b/kvision-modules/kvision-bootstrap-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt index ead19d86..bb090b61 100644 --- a/kvision-modules/kvision-bootstrap-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt +++ b/kvision-modules/kvision-bootstrap-spinner/src/test/kotlin/test/pl/treksoft/kvision/form/spinner/SpinnerSpec.kt @@ -43,13 +43,13 @@ class SpinnerSpec : DomSpec { val element = document.getElementById("test") val id = ti.input.id assertEqualsHtml( - "
", + "
", element?.innerHTML, "Should render correct spinner input form control" ) ti.validatorError = "Validation Error" assertEqualsHtml( - "
Validation Error
", + "
Validation Error
", element?.innerHTML, "Should render correct spinner input form control with validation error" ) diff --git a/kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js new file mode 100644 index 00000000..bf5a1a20 --- /dev/null +++ b/kvision-modules/kvision-bootstrap-upload/webpack.config.d/jquery.js @@ -0,0 +1,5 @@ +config.plugins.push(new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery", + "window.jQuery": "jquery" +})); diff --git a/kvision-modules/kvision-bootstrap/build.gradle b/kvision-modules/kvision-bootstrap/build.gradle index 34aa8bb0..fe519014 100644 --- a/kvision-modules/kvision-bootstrap/build.gradle +++ b/kvision-modules/kvision-bootstrap/build.gradle @@ -3,6 +3,7 @@ apply from: "../shared.gradle" kotlinFrontend { npm { + dependency("popper.js", "1.15.0") dependency("bootstrap", "4.3.1") dependency("awesome-bootstrap-checkbox", "1.0.1") dependency("element-resize-event", "3.0.3") diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt index 1ad97acc..fc3d5242 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt @@ -70,8 +70,8 @@ interface DomSpec : TestSpec { fun assertEqualsHtml(expected: String?, actual: String?, message: String?) { if (expected != null && actual != null) { - val exp = jQuery(expected) - val act = jQuery(actual) + val exp = jQuery(expected.replace("position: ;","position: absolute;")) + val act = jQuery(actual.replace("position: ;","position: absolute;")) val result = exp[0]?.isEqualNode(act[0]) if (result == true) { assertTrue(result == true, message) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt index 35172267..b467f1ff 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt @@ -22,6 +22,7 @@ package test.pl.treksoft.kvision.dropdown import pl.treksoft.kvision.dropdown.ContextMenu +import pl.treksoft.kvision.dropdown.ContextMenu.Companion.setContextMenu import pl.treksoft.kvision.html.Link.Companion.link import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.utils.obj @@ -43,7 +44,7 @@ class ContextMenuSpec : DomSpec { m.show() val element = document.getElementById("test") assertEqualsHtml( - "", + "", element?.innerHTML, "Should render correct context menu" ) @@ -66,7 +67,7 @@ class ContextMenuSpec : DomSpec { }) val element = document.getElementById("test") assertEqualsHtml( - "", + "", element?.innerHTML, "Should place context menu in the correct position" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt index af35fa51..f75331f3 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/DropDownSpec.kt @@ -22,6 +22,7 @@ package test.pl.treksoft.kvision.dropdown import pl.treksoft.kvision.dropdown.DD +import pl.treksoft.kvision.dropdown.Direction import pl.treksoft.kvision.dropdown.DropDown import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec @@ -37,11 +38,11 @@ class DropDownSpec : DomSpec { val root = Root("test", fixed = true) val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag") root.add(dd) - dd.toggle() + dd.list.getElementJQueryD()?.dropdown("toggle") val element = document.getElementById("test") val id = dd.buttonId() assertEqualsHtml( - "
", + "
", element?.innerHTML, "Should render correct drop down" ) @@ -52,13 +53,13 @@ class DropDownSpec : DomSpec { fun renderDropUp() { run { val root = Root("test", fixed = true) - val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag").apply { dropup = true } + val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag").apply { direction = Direction.DROPUP } root.add(dd) - dd.toggle() + dd.list.getElementJQueryD()?.dropdown("toggle") val element = document.getElementById("test") val id = dd.buttonId() assertEqualsHtml( - "
", + "
", element?.innerHTML, "Should render correct drop down" ) @@ -71,11 +72,11 @@ class DropDownSpec : DomSpec { val root = Root("test", fixed = true) val dd = DropDown("Dropdown", listOf("abc" to DD.HEADER.option), "flag") root.add(dd) - dd.toggle() + dd.list.getElementJQueryD()?.dropdown("toggle") val element = document.getElementById("test") val id = dd.buttonId() assertEqualsHtml( - "
  • abc
", + "
abc
", element?.innerHTML, "Should render correct drop down" ) @@ -88,11 +89,11 @@ class DropDownSpec : DomSpec { val root = Root("test", fixed = true) val dd = DropDown("Dropdown", listOf("abc" to DD.SEPARATOR.option), "flag") root.add(dd) - dd.toggle() + dd.list.getElementJQueryD()?.dropdown("toggle") val element = document.getElementById("test") val id = dd.buttonId() assertEqualsHtml( - "
", + "
", element?.innerHTML, "Should render correct drop down" ) @@ -105,11 +106,11 @@ class DropDownSpec : DomSpec { val root = Root("test", fixed = true) val dd = DropDown("Dropdown", listOf("abc" to DD.DISABLED.option), "flag") root.add(dd) - dd.toggle() + dd.list.getElementJQueryD()?.dropdown("toggle") val element = document.getElementById("test") val id = dd.buttonId() assertEqualsHtml( - "
", + "
", element?.innerHTML, "Should render correct drop down" ) @@ -122,10 +123,10 @@ class DropDownSpec : DomSpec { val root = Root("test", fixed = true) val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag") root.add(dd) - val visible = dd.getElementJQuery()?.hasClass("open") ?: false + val visible = dd.getElementJQuery()?.hasClass("show") ?: false assertTrue("Dropdown menu is not visible before toggle") { !visible } - dd.toggle() - val visible2 = dd.getElementJQuery()?.hasClass("open") ?: false + dd.list.getElementJQueryD()?.dropdown("toggle") + val visible2 = dd.getElementJQuery()?.hasClass("show") ?: false assertTrue("Dropdown menu is visible after toggle") { visible2 } } } diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt index e75baf9e..25ca7a7d 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/HeaderSpec.kt @@ -37,7 +37,7 @@ class HeaderSpec : DomSpec { root.add(h) val element = document.getElementById("test") assertEqualsHtml( - "
  • Test
  • ", + "
    Test
    ", element?.innerHTML, "Should render correct drop down header" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt index 86607ec7..36c22a74 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/SeparatorSpec.kt @@ -37,7 +37,7 @@ class SeparatorSpec : DomSpec { root.add(s) val element = document.getElementById("test") assertEqualsHtml( - "
  • ", + "
    ", element?.innerHTML, "Should render correct drop down separator" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt index c3d17de9..48a8b5a0 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/modal/AlertSpec.kt @@ -37,22 +37,22 @@ class AlertSpec : DomSpec { fun render() { run { Root("test", fixed = true) - Alert.show("Alert caption", "Alert content") - val alert = document.getElementById("test")?.let { jQuery(it).find(".modal")[0] } + Alert.show("Alert caption", "Alert content", animation = false) + val alert = document.getElementById("test")?.let { jQuery(it).parent().parent().find(".modal")[0] } assertNotNull(alert, "Should show alert window") - val title = document.getElementById("test")?.let { jQuery(it).find(".modal-title").html() } + val title = document.getElementById("test")?.let { jQuery(it).parent().parent().find(".modal-title").html() } assertEquals("Alert caption", title, "Should render alert window with correct caption") - val body = document.getElementById("test")?.let { jQuery(it).find(".modal-body").html() } + val body = document.getElementById("test")?.let { jQuery(it).parent().parent().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() } + val footer = document.getElementById("test")?.let { jQuery(it).parent().parent().find(".modal-footer").html() } assertEqualsHtml( - "", + "", footer, "Should render alert window with correct footer" ) - val button = document.getElementById("test")?.let { jQuery(it).find(".modal-footer").find("button") } + val button = document.getElementById("test")?.let { jQuery(it).parent().parent().find(".modal-footer").find("button") } button?.click() - val alert2 = document.getElementById("test")?.let { jQuery(it).find(".modal")[0] } + val alert2 = document.getElementById("test")?.let { jQuery(it).parent().parent().find(".modal")[0] } assertNull(alert2, "Should hide alert window after clicking OK") } } diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt index 40720bcb..8eb7bd5b 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavFormSpec.kt @@ -37,13 +37,13 @@ class NavFormSpec : DomSpec { root.add(navf) val element = document.getElementById("test") assertEqualsHtml( - "
    ", + "
    ", element?.innerHTML, "Should render correct nav form" ) navf.rightAlign = true assertEqualsHtml( - "
    ", + "
    ", element?.innerHTML, "Should render correct right aligned nav form" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt index 988a706d..2e52557f 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavSpec.kt @@ -37,13 +37,13 @@ class NavSpec : DomSpec { root.add(nav) val element = document.getElementById("test") assertEqualsHtml( - "
      ", + "
      ", element?.innerHTML, "Should render correct nav" ) nav.rightAlign = true assertEqualsHtml( - "
        ", + "
        ", element?.innerHTML, "Should render correct right aligned nav" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt index f38a05f9..1658e63c 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt @@ -26,6 +26,7 @@ import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag.Companion.tag import pl.treksoft.kvision.navbar.Nav import pl.treksoft.kvision.navbar.Navbar +import pl.treksoft.kvision.navbar.NavbarColor import pl.treksoft.kvision.navbar.NavbarType import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec @@ -43,15 +44,15 @@ class NavbarSpec : DomSpec { val element = document.getElementById("test") val id = navbar.container.id assertEqualsHtml( - "", + "", element?.innerHTML, "Should render correct navbar" ) - navbar.inverted = true + navbar.nColor = NavbarColor.DARK assertEqualsHtml( - "", + "", element?.innerHTML, - "Should render correct inverted navbar" + "Should render correct dark navbar" ) navbar.add(Nav { tag(TAG.LI) { @@ -59,7 +60,7 @@ class NavbarSpec : DomSpec { } }) assertEqualsHtml( - "", + "", element?.innerHTML, "Should render correct navbar with nav link" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt index fcdf9860..1ebac202 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt @@ -41,7 +41,7 @@ class ResponsiveGridPanelSpec : DomSpec { rgPanel.add(Span("ghi"), 3, 3) val element = document.getElementById("test") assertEqualsHtml( - "
        abc
        def
        ghi
        ", + "
        abc
        def
        ghi
        ", element?.innerHTML, "Should render correct responsive grid panel" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt index 9335562f..7a76cde9 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt @@ -43,7 +43,7 @@ class TabPanelSpec : DomSpec { tabs.addTab("DEF", label2) val element = document.getElementById("test") assertEqualsHtml( - "
        abc
        ", + "
        abc
        ", element?.innerHTML, "Should render correct tabs" ) @@ -63,7 +63,7 @@ class TabPanelSpec : DomSpec { tabs.activeIndex = 1 val element = document.getElementById("test") assertEqualsHtml( - "
        def
        ", + "
        def
        ", element?.innerHTML, "Should change selected tab" ) @@ -84,7 +84,7 @@ class TabPanelSpec : DomSpec { tabs.removeTab(1) val element = document.getElementById("test") assertEqualsHtml( - "
        abc
        ", + "
        abc
        ", element?.innerHTML, "Should remove tab" ) @@ -105,10 +105,10 @@ class TabPanelSpec : DomSpec { tabs.removeTab(0) val label3 = Span("ghi") tabs.addTab("GHI", label3) - jQuery("#test a")[0]?.click() + jQuery("#test a")[1]?.click() val element = document.getElementById("test") assertEqualsHtml( - "
        def
        ", + "
        ghi
        ", element?.innerHTML, "Should select correct tab by clicking" ) diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt index b324b8ab..b3ddbe40 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/toolbar/ButtonGroupSpec.kt @@ -24,7 +24,6 @@ package test.pl.treksoft.kvision.toolbar import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.toolbar.ButtonGroup import pl.treksoft.kvision.toolbar.ButtonGroupSize -import pl.treksoft.kvision.toolbar.ButtonGroupStyle import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test @@ -44,11 +43,11 @@ class ButtonGroupSpec : DomSpec { "Should render correct button group" ) group.size = ButtonGroupSize.LARGE - group.style = ButtonGroupStyle.JUSTIFIED + group.vertical = true assertEqualsHtml( - "
        ", + "
        ", element?.innerHTML, - "Should render correct button group with large and justified buttons" + "Should render correct button group with large and vertical buttons" ) } diff --git a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt index c79b9d32..a65ff7c3 100644 --- a/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt +++ b/kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/window/WindowSpec.kt @@ -35,18 +35,13 @@ class WindowSpec : DomSpec { val root = Root("test", fixed = true) val window = Window("Window title", isResizable = false) root.add(window) + window.show() val id = window.id val element = document.getElementById("test") assertEqualsHtml( - "

        Window title

        ", + "
        Window title
        ", element?.innerHTML, - "Should render floating window without resizable handler" - ) - window.isResizable = true - assertEqualsHtml( - "

        Window title

        ", - element?.innerHTML, - "Should render floating window with resizable handler" + "Should render floating window" ) } } diff --git a/kvision-modules/kvision-chart/webpack.config.d/css.js b/kvision-modules/kvision-chart/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-chart/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-cordova/webpack.config.d/css.js b/kvision-modules/kvision-cordova/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-cordova/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-datacontainer/webpack.config.d/css.js b/kvision-modules/kvision-datacontainer/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-datacontainer/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-i18n/webpack.config.d/css.js b/kvision-modules/kvision-i18n/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-i18n/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-redux-kotlin/webpack.config.d/css.js b/kvision-modules/kvision-redux-kotlin/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-redux-kotlin/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-redux/webpack.config.d/css.js b/kvision-modules/kvision-redux/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-redux/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/kvision-modules/kvision-richtext/webpack.config.d/jquery.js b/kvision-modules/kvision-richtext/webpack.config.d/jquery.js new file mode 100644 index 00000000..bf5a1a20 --- /dev/null +++ b/kvision-modules/kvision-richtext/webpack.config.d/jquery.js @@ -0,0 +1,5 @@ +config.plugins.push(new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery", + "window.jQuery": "jquery" +})); diff --git a/kvision-modules/kvision-tabulator-remote/webpack.config.d/css.js b/kvision-modules/kvision-tabulator-remote/webpack.config.d/css.js new file mode 100644 index 00000000..5d710d35 --- /dev/null +++ b/kvision-modules/kvision-tabulator-remote/webpack.config.d/css.js @@ -0,0 +1,2 @@ +config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); + diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt index 4be84d22..785f9a2c 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/HelpTextSpec.kt @@ -27,7 +27,7 @@ import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test -class HelpBlockSpec : DomSpec { +class HelpTextSpec : DomSpec { @Test fun render() { @@ -37,7 +37,7 @@ class HelpBlockSpec : DomSpec { root.add(fl) val element = document.getElementById("test") assertEqualsHtml( - "Form Error", + "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 16da0c70..2c329ffa 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 @@ -45,7 +45,7 @@ class CheckBoxSpec : DomSpec { val element = document.getElementById("test") val id = ci.input.id assertEqualsHtml( - "
        ", + "
        ", element?.innerHTML, "Should render correct checkbox form control" ) @@ -53,7 +53,7 @@ class CheckBoxSpec : DomSpec { ci.circled = false ci.inline = false assertEqualsHtml( - "
        ", + "
        ", element?.innerHTML, "Should render correct checkbox form control" ) diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt index 55788c84..020ad529 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioGroupInputSpec.kt @@ -44,7 +44,7 @@ class RadioGroupInputSpec : DomSpec { val rid1 = ci.getChildren().filterIsInstance().first().input.id val rid2 = ci.getChildren().filterIsInstance().last().input.id assertEqualsHtml( - "
        ", + "
        ", element?.innerHTML, "Should render correct radio button group form 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 2ed52b67..77547977 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 @@ -41,10 +41,10 @@ class RadioGroupSpec : DomSpec { root.add(ci) val element = document.getElementById("test") val id = ci.flabel.forId - val rid1 = ci.getChildren().filterIsInstance().first().input.id - val rid2 = ci.getChildren().filterIsInstance().last().input.id + val rid1 = ci.container.getChildren().filterIsInstance().first().input.id + val rid2 = ci.container.getChildren().filterIsInstance().last().input.id 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 bd0b3993..c709b548 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 @@ -44,7 +44,7 @@ class RadioSpec : DomSpec { val element = document.getElementById("test") val id = ci.input.id assertEqualsHtml( - "
        ", + "
        ", element?.innerHTML, "Should render correct radio button form control" ) @@ -52,7 +52,7 @@ class RadioSpec : DomSpec { ci.squared = true ci.inline = false assertEqualsHtml( - "
        ", + "
        ", element?.innerHTML, "Should render correct radio button form 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 2bc35a38..02ba7643 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 @@ -49,7 +49,7 @@ class TextSpec : DomSpec { ) ti.validatorError = "Validation Error" assertEqualsHtml( - "
        Validation Error
        ", + "
        Validation Error
        ", element?.innerHTML, "Should render correct 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 512c3bc2..e807bfd5 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ButtonSpec.kt @@ -35,13 +35,13 @@ class ButtonSpec : DomSpec { fun render() { run { val root = Root("test", fixed = true) - val button = Button("Cancel", "fa-bars", ButtonStyle.PRIMARY) + val button = Button("Cancel", "fas fa-bars", ButtonStyle.PRIMARY) button.size = ButtonSize.LARGE button.block = true root.add(button) val element = document.getElementById("test") assertEqualsHtml( - "", + "", element?.innerHTML, "Should render correct html button" ) diff --git a/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt index ea3425c5..9a63c68e 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/IconSpec.kt @@ -33,10 +33,10 @@ class IconSpec : DomSpec { fun render() { run { val root = Root("test", fixed = true) - val icon = Icon("fa-check") + val icon = Icon("fas fa-check") root.add(icon) val element = document.getElementById("test") - assertEqualsHtml("", element?.innerHTML, "Should render correct icon") + assertEqualsHtml("", element?.innerHTML, "Should render correct icon") } } 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 169575fc..ed3a5347 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/ImageSpec.kt @@ -41,7 +41,7 @@ class ImageSpec : DomSpec { root.add(image) val element = document.getElementById("test") assertEqualsHtml( - "\"Image\"", + "\"Image\"", element?.innerHTML, "Should render correct html image" ) diff --git a/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt index c312040a..69dc05d3 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt @@ -46,7 +46,7 @@ class TableSpec : DomSpec { root.add(table) val element = document.getElementById("test") assertEqualsHtml( - "
        ab
        AB
        ", + "
        ab
        AB
        ", element?.innerHTML, "Should render correct table" ) @@ -55,7 +55,7 @@ class TableSpec : DomSpec { table.types = setOf(TableType.BORDERED) val element2 = document.getElementById("test") assertEqualsHtml( - "
        Caption
        ab
        AB
        ", + "
        Caption
        ab
        AB
        ", element2?.innerHTML, "Should render correct responsive table" ) -- cgit