diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-01-31 00:10:58 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-01-31 00:10:58 +0100 |
commit | facf7991ed52cb21852dd6175a3817e94598c2dc (patch) | |
tree | aa4364769bbe0c3d637af8061761ef32c2234c37 /examples/todomvc/src/test | |
parent | a3514f0ea18313d37b9701e055f97f7ad81f76c4 (diff) | |
download | kvision-facf7991ed52cb21852dd6175a3817e94598c2dc.tar.gz kvision-facf7991ed52cb21852dd6175a3817e94598c2dc.tar.bz2 kvision-facf7991ed52cb21852dd6175a3817e94598c2dc.zip |
TodoMVC example
Diffstat (limited to 'examples/todomvc/src/test')
-rw-r--r-- | examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt | 32 |
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() + } + +} |