Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140847

Testing javascript that updates DOM

$
0
0

I am new to web testing and would like to know how can I test javascript that reads and updates the DOM.

function otherFunction(string) {
// do some processing and return processed data
}

function domUpdater() {
  var string = document.getElementById("input").value;
  document.getElementById("output").innerHTML = otherFunction(string);
}

I can test easily the otherFunction which accepts and input and returns an output.

expect(otherFunction("input1")).to.be("expected1");
expect(otherFunction("input2")).to.be("expected2");

I am not clear on how can I test the domUpdater function which modifies the DOM?


Viewing all articles
Browse latest Browse all 140847

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>