aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle4
-rw-r--r--kvision-modules/kvision-common-remote/build.gradle (renamed from kvision-modules/kvision-common/build.gradle)0
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteSelectOption.kt36
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt)0
-rw-r--r--kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt)0
-rw-r--r--kvision-modules/kvision-common-types/build.gradle10
-rw-r--r--kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt)0
-rw-r--r--kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt)0
-rw-r--r--kvision-modules/kvision-remote/build.gradle5
-rw-r--r--kvision-modules/kvision-remote/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyRemoteAgent.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/JoobyRemoteAgent.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/Security.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringRemoteAgent.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/SpringRemoteAgent.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt (renamed from src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt)0
-rw-r--r--kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt99
-rw-r--r--kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt57
-rw-r--r--kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt56
-rw-r--r--kvision-modules/kvision-server-jooby/build.gradle6
-rw-r--r--kvision-modules/kvision-server-spring-boot/build.gradle6
-rw-r--r--settings.gradle4
27 files changed, 280 insertions, 6 deletions
diff --git a/build.gradle b/build.gradle
index e1728313..20ef7bb6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -99,7 +99,7 @@ apply plugin: 'kotlinx-serialization'
dependencies {
if (!project.gradle.startParameter.taskNames.contains("dokka")) {
- expectedBy project('kvision-modules:kvision-common')
+ expectedBy project('kvision-modules:kvision-common-types')
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion"
@@ -160,7 +160,9 @@ dokka {
'kvision-modules/kvision-upload/src/main/kotlin',
'kvision-modules/kvision-handlebars/src/main/kotlin',
'kvision-modules/kvision-i18n/src/main/kotlin',
+ 'kvision-modules/kvision-remote/src/main/kotlin',
'kvision-modules/kvision-common/src/main/kotlin',
+ 'kvision-modules/kvision-common-types/src/main/kotlin',
'kvision-modules/kvision-server-jooby/src/main/kotlin',
'kvision-modules/kvision-server-spring-boot/src/main/kotlin')
classpath = [new File("dokka/kvision-dokka-helper.jar")]
diff --git a/kvision-modules/kvision-common/build.gradle b/kvision-modules/kvision-common-remote/build.gradle
index af3703e6..af3703e6 100644
--- a/kvision-modules/kvision-common/build.gradle
+++ b/kvision-modules/kvision-common-remote/build.gradle
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
index cb1b44d0..cb1b44d0 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
+++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
index 7953ea01..7953ea01 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
+++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/JsonRpc.kt
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
index cf822e66..cf822e66 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
+++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteSelectOption.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteSelectOption.kt
new file mode 100644
index 00000000..24e68f63
--- /dev/null
+++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteSelectOption.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package pl.treksoft.kvision.remote
+
+import kotlinx.serialization.Serializable
+
+@Serializable
+data class RemoteSelectOption(
+ val value: String? = null,
+ val text: String? = null,
+ val className: String? = null,
+ val subtext: String? = null,
+ val icon: String? = null,
+ val content: String? = null,
+ val disabled: Boolean = false,
+ val divider: Boolean = false
+)
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
index 6f696475..6f696475 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
+++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
index 90926656..90926656 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
+++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
diff --git a/kvision-modules/kvision-common-types/build.gradle b/kvision-modules/kvision-common-types/build.gradle
new file mode 100644
index 00000000..af3703e6
--- /dev/null
+++ b/kvision-modules/kvision-common-types/build.gradle
@@ -0,0 +1,10 @@
+apply plugin: 'kotlin-platform-common'
+apply plugin: 'kotlinx-serialization'
+
+dependencies {
+ compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
+ compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion"
+ compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion"
+ testCompile "org.jetbrains.kotlin:kotlin-test-common:$kotlinVersion"
+ testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlinVersion"
+}
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index 86a72b33..86a72b33 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt
index ce4adca4..ce4adca4 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt
+++ b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/KFile.kt
diff --git a/kvision-modules/kvision-remote/build.gradle b/kvision-modules/kvision-remote/build.gradle
new file mode 100644
index 00000000..b99fb199
--- /dev/null
+++ b/kvision-modules/kvision-remote/build.gradle
@@ -0,0 +1,5 @@
+apply from: "../shared.gradle"
+
+dependencies {
+ expectedBy project(":kvision-modules:kvision-common-remote")
+}
diff --git a/kvision-modules/kvision-remote/package.json.d/project.info b/kvision-modules/kvision-remote/package.json.d/project.info
new file mode 100644
index 00000000..cfee4b2f
--- /dev/null
+++ b/kvision-modules/kvision-remote/package.json.d/project.info
@@ -0,0 +1,3 @@
+{
+ "description": "KVision Remote module"
+}
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
index 4a086e2a..4a086e2a 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/JoobyRemoteAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyRemoteAgent.kt
index 318f77ea..318f77ea 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/JoobyRemoteAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyRemoteAgent.kt
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
index 0d3515a1..0d3515a1 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/JoobyServiceManager.kt
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
index a1cc40ca..a1cc40ca 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
index cbb2978a..cbb2978a 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/RemoteAgent.kt
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
index b485e17d..b485e17d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/SpringRemoteAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringRemoteAgent.kt
index fea16b99..fea16b99 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/SpringRemoteAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringRemoteAgent.kt
diff --git a/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
index 524347d7..524347d7 100644
--- a/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/SpringServiceManager.kt
diff --git a/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt b/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt
new file mode 100644
index 00000000..1da1fe1a
--- /dev/null
+++ b/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/TestUtil.kt
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package test.pl.treksoft.kvision
+
+import org.w3c.dom.Element
+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()
+
+ fun afterTest()
+
+ fun run(code: () -> Unit) {
+ beforeTest()
+ code()
+ afterTest()
+ }
+}
+
+interface SimpleSpec : TestSpec {
+
+ override fun beforeTest() {
+ }
+
+ override fun afterTest() {
+ }
+
+}
+
+interface DomSpec : TestSpec {
+
+ override fun beforeTest() {
+ val fixture = "<div style=\"display: none\" id=\"pretest\">" +
+ "<div id=\"test\"></div></div>"
+ document.body?.insertAdjacentHTML("afterbegin", fixture)
+ }
+
+ override fun afterTest() {
+ val div = document.getElementById("pretest")
+ div?.let { jQuery(it).remove() }
+ 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 {
+
+ fun runW(code: (widget: Widget, element: Element?) -> Unit) {
+ run {
+ val root = Root("test", true)
+ val widget = Widget()
+ widget.id = "test_id"
+ root.add(widget)
+ val element = document.getElementById("test_id")
+ code(widget, element)
+ }
+ }
+
+}
+
+external fun require(name: String): dynamic
diff --git a/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt b/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt
new file mode 100644
index 00000000..626b70e4
--- /dev/null
+++ b/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadInputSpec.kt
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package test.pl.treksoft.kvision.form.upload
+
+import pl.treksoft.jquery.jQuery
+import pl.treksoft.kvision.form.upload.UploadInput
+import pl.treksoft.kvision.panel.Root
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+
+class UploadInputSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test", true)
+ val upi = UploadInput(multiple = true).apply {
+ id = "idti"
+ }
+ root.add(upi)
+ val content = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
+ assertEqualsHtml(
+ "<input class=\"form-control\" id=\"idti\" type=\"file\" multiple=\"true\">",
+ content,
+ "Should render correct file input control for multiple files"
+ )
+ upi.multiple = false
+ val content2 = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
+ assertEqualsHtml(
+ "<input class=\"form-control\" id=\"idti\" type=\"file\">",
+ content2,
+ "Should render correct file input control for single file"
+ )
+ }
+ }
+
+}
diff --git a/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt b/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt
new file mode 100644
index 00000000..bea4ddee
--- /dev/null
+++ b/kvision-modules/kvision-remote/src/test/kotlin/test/pl/treksoft/kvision/form/upload/UploadSpec.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package test.pl.treksoft.kvision.form.upload
+
+import pl.treksoft.jquery.jQuery
+import pl.treksoft.kvision.form.upload.Upload
+import pl.treksoft.kvision.panel.Root
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+
+class UploadSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test", true)
+ val upi = Upload(multiple = true)
+ val id = upi.input.id
+ root.add(upi)
+ val content = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
+ assertEqualsHtml(
+ "<input class=\"form-control\" id=\"$id\" type=\"file\" multiple=\"true\">",
+ content,
+ "Should render correct file input control for multiple files"
+ )
+ upi.multiple = false
+ val content2 = document.getElementById("test")?.let { jQuery(it).find("input.form-control")[0]?.outerHTML }
+ assertEqualsHtml(
+ "<input class=\"form-control\" id=\"$id\" type=\"file\">",
+ content2,
+ "Should render correct file input control for single file"
+ )
+ }
+ }
+
+}
diff --git a/kvision-modules/kvision-server-jooby/build.gradle b/kvision-modules/kvision-server-jooby/build.gradle
index b3912c2c..74ccbad5 100644
--- a/kvision-modules/kvision-server-jooby/build.gradle
+++ b/kvision-modules/kvision-server-jooby/build.gradle
@@ -9,7 +9,8 @@ dependencyManagement {
}
dependencies {
- expectedBy project(":kvision-modules:kvision-common")
+ expectedBy project(":kvision-modules:kvision-common-types")
+ expectedBy project(":kvision-modules:kvision-common-remote")
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
@@ -22,7 +23,8 @@ dependencies {
compile "com.github.andrewoma.kwery:mapper:${kweryVersion}"
compile "com.fasterxml.jackson.module:jackson-module-kotlin:${jacksonModuleKotlinVersion}"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
- testCompile project(":kvision-modules:kvision-common")
+ testCompile project(":kvision-modules:kvision-common-types")
+ testCompile project(":kvision-modules:kvision-common-remote")
}
compileKotlin {
diff --git a/kvision-modules/kvision-server-spring-boot/build.gradle b/kvision-modules/kvision-server-spring-boot/build.gradle
index 43d8650d..2b9727ac 100644
--- a/kvision-modules/kvision-server-spring-boot/build.gradle
+++ b/kvision-modules/kvision-server-spring-boot/build.gradle
@@ -2,7 +2,8 @@ apply plugin: 'kotlin-platform-jvm'
apply plugin: 'kotlinx-serialization'
dependencies {
- expectedBy project(":kvision-modules:kvision-common")
+ expectedBy project(":kvision-modules:kvision-common-types")
+ expectedBy project(":kvision-modules:kvision-common-remote")
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
@@ -15,7 +16,8 @@ dependencies {
compile "com.github.andrewoma.kwery:mapper:${kweryVersion}"
compile "com.fasterxml.jackson.module:jackson-module-kotlin:${jacksonModuleKotlinVersion}"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
- testCompile project(":kvision-modules:kvision-common")
+ testCompile project(":kvision-modules:kvision-common-types")
+ testCompile project(":kvision-modules:kvision-common-remote")
}
compileKotlin {
diff --git a/settings.gradle b/settings.gradle
index a8cb0e9c..c3360ffe 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,7 +1,8 @@
rootProject.name = 'kvision'
include 'kvision-modules:kvision-base',
- 'kvision-modules:kvision-common',
+ 'kvision-modules:kvision-common-remote',
+ 'kvision-modules:kvision-common-types',
'kvision-modules:kvision-bootstrap',
'kvision-modules:kvision-select',
'kvision-modules:kvision-datetime',
@@ -10,5 +11,6 @@ include 'kvision-modules:kvision-base',
'kvision-modules:kvision-upload',
'kvision-modules:kvision-handlebars',
'kvision-modules:kvision-i18n',
+ 'kvision-modules:kvision-remote',
'kvision-modules:kvision-server-jooby',
'kvision-modules:kvision-server-spring-boot'