A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://stackoverflow.com/questions/58096529/how-to-perform-unit-test-for-binding-scala below:

scalatest - How to perform unit test for Binding.Scala?

In current version of Binding.scala (11.8.1) you can use this method for unit testing:

  "Comment" in {
    @dom def comment = <div><!--my comment--></div>
    val div = document.createElement("div")
    dom.render(div, comment)
    assert(div.innerHTML == "<div><!--my comment--></div>")
  }

Unfortunately, you couldn't write such (more performant?) tests:

  "TextElement" in {
    @dom val monadicDiv: Binding[Div] = <div>text</div>
    monadicDiv.watch()
    assert(monadicDiv.get.outerHTML == "<div>text</div>")
  }

because of Binding.get/Binding.value is private/protected. I filled issue about this https://github.com/ThoughtWorksInc/Binding.scala/issues/217


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4