aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt38
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt37
2 files changed, 75 insertions, 0 deletions
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt
new file mode 100644
index 00000000..0ca5c7de
--- /dev/null
+++ b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressBarSpec.kt
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018. Robert Jaros
+ */
+package test.pl.treksoft.kvision.progress
+
+import pl.treksoft.kvision.panel.Root
+import pl.treksoft.kvision.progress.ProgressBar
+import pl.treksoft.kvision.progress.ProgressBarStyle
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+
+class ProgressBarSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test", true)
+ val progressBar =
+ ProgressBar(50, style = ProgressBarStyle.SUCCESS, striped = true, content = "Processing ...")
+ root.add(progressBar)
+ val element = document.getElementById("test")
+ assertEqualsHtml(
+ "<div class=\"progress\"><div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 50%;\">Processing ...</div></div>",
+ element?.innerHTML,
+ "Should render correct progress bar"
+ )
+ progressBar.max = 200
+ assertEqualsHtml(
+ "<div class=\"progress\"><div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"200\" style=\"width: 25%;\">Processing ...</div></div>",
+ element?.innerHTML,
+ "Should render correct progress bar after max value change"
+ )
+
+ }
+ }
+
+}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt
new file mode 100644
index 00000000..21247ba4
--- /dev/null
+++ b/src/test/kotlin/test/pl/treksoft/kvision/progress/ProgressIndicatorSpec.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018. Robert Jaros
+ */
+package test.pl.treksoft.kvision.progress
+
+import pl.treksoft.kvision.panel.Root
+import pl.treksoft.kvision.progress.ProgressBarStyle
+import pl.treksoft.kvision.progress.ProgressIndicator
+import test.pl.treksoft.kvision.DomSpec
+import kotlin.browser.document
+import kotlin.test.Test
+
+class ProgressIndicatorSpec : DomSpec {
+
+ @Test
+ fun render() {
+ run {
+ val root = Root("test", true)
+ val ind = ProgressIndicator(50, style = ProgressBarStyle.SUCCESS, striped = true)
+ root.add(ind)
+ val element = document.getElementById("test")
+ assertEqualsHtml(
+ "<div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: 50%;\"></div>",
+ element?.innerHTML,
+ "Should render correct progress bar indicator"
+ )
+ ind.max = 200
+ assertEqualsHtml(
+ "<div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\" aria-valuenow=\"50\" aria-valuemin=\"0\" aria-valuemax=\"200\" style=\"width: 25%;\"></div>",
+ element?.innerHTML,
+ "Should render correct progress bar indicator after max value change"
+ )
+
+ }
+ }
+
+}