diff options
author | Haoyi Li <haoyi@haoyi-mbp.corp.dropbox.com> | 2014-11-26 00:45:31 -0800 |
---|---|---|
committer | Haoyi Li <haoyi@haoyi-mbp.corp.dropbox.com> | 2014-11-26 00:45:31 -0800 |
commit | 2c4b142503bd2d871e6818b5cab8c38627d9e4a0 (patch) | |
tree | 6ba33d2980a1a7a1286100202a695c6631bd240e /examples/testing/src/test/scala/ElementCreatorTest.scala | |
download | hands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.tar.gz hands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.tar.bz2 hands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.zip |
Squashed 'examples/scala-js/' content from commit 47311ba
git-subtree-dir: examples/scala-js
git-subtree-split: 47311ba693f949f204f27ea9475bb63425fbd4f3
Diffstat (limited to 'examples/testing/src/test/scala/ElementCreatorTest.scala')
-rw-r--r-- | examples/testing/src/test/scala/ElementCreatorTest.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/testing/src/test/scala/ElementCreatorTest.scala b/examples/testing/src/test/scala/ElementCreatorTest.scala new file mode 100644 index 0000000..43f6756 --- /dev/null +++ b/examples/testing/src/test/scala/ElementCreatorTest.scala @@ -0,0 +1,24 @@ +import scala.scalajs.js +import scala.scalajs.js.Dynamic.global + +import org.scalajs.jasminetest.JasmineTest + +object ElementCreatorTest extends JasmineTest { + + describe("ElementCreator") { + + it("should be able to create an element in the body") { + // create the element + ElementCreator.create() + + // jquery would make this easier, but I wanted to + // only use pure html in the test itself + val body = global.document.getElementsByTagName("body") + .asInstanceOf[js.Array[js.Dynamic]].head + + // the Scala.js DOM API would make this easier + expect(body.lastChild.tagName.toString == "H1").toBeTruthy + expect(body.lastChild.innerHTML.toString == "Test").toBeTruthy + } + } +} |