aboutsummaryrefslogtreecommitdiff
path: root/examples/todomvc/src/test/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'examples/todomvc/src/test/kotlin')
-rw-r--r--examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt b/examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt
new file mode 100644
index 00000000..c5ec014f
--- /dev/null
+++ b/examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt
@@ -0,0 +1,32 @@
+package test.com.example
+
+import pl.treksoft.jquery.jQuery
+import kotlin.browser.document
+
+interface TestSpec {
+ fun beforeTest()
+
+ fun afterTest()
+
+ fun run(code: () -> Unit) {
+ beforeTest()
+ code()
+ afterTest()
+ }
+}
+
+interface DomSpec : TestSpec {
+
+ override fun beforeTest() {
+ val fixture = "<div style=\"display: none\" id=\"pretest\">" +
+ "<div id=\"helloworld\"></div></div>"
+ document.body?.insertAdjacentHTML("afterbegin", fixture)
+ }
+
+ override fun afterTest() {
+ val div = document.getElementById("pretest")
+ div?.remove()
+ jQuery(`object` = ".modal-backdrop").remove()
+ }
+
+}