The introduction to QUnit over at netTuts.com spawns an interesting exchange (never resolved) over how to apply unit tests against actions that manipulate the DOM. The following quote (Alex York) gets to the crux:
What would be nice is that if you had a function like this:
function add(a, b) { var result = a + b; $(“input#ResultTestBox”).val(result);
In the above test, I would love to test two things: the addition of a and b, and the result correctly being put into a DOM element. I would love to test the second thing by providing some mock HTML. Possible?
But, like i said...unresolved. Resolvable?
thx