jsdom - A JavaScript implementation of the DOM and HTML standards.
A JavaScript implementation of the DOM and HTML standards
$ sbt clean publish-local
Before running the tests the first time, you must ensure the npm packages are installed:
$ npm install
Then you can run the tests:
$ sbt test
import io.scalajs.dom.html.HTMLAnchorElement
import io.scalajs.npm.jsdom._
val doc = JsDom.jsdom("""<p id="p1"><a class="the-link" href="https://github.com/tmpvar/jsdom">jsdom!</a></p>""")
val elem = doc.getElementsByClassName("the-link").headOption.orNull
assert(elem != null)
val text = elem.asInstanceOf[HTMLAnchorElement].text
assert(text == "jsdom!")
To add the Jsdom
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "jsdom" % "0.5.0"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")