title: How can we execute Unit Tests against DOM manipulation?
body: <p>The introduction to QUnit over at <a href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-test-your-javascript-code-with-qunit/" rel="nofollow noreferrer">netTuts.com</a> 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:</p>
  
  <blockquote>
    <p>What would be nice is that if you had
    a function like this:</p>
    
    <p>function add(a, b) { var result = a +
    b;
    $(“input#ResultTestBox”).val(result);</p>
    
    <p>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?</p>
  </blockquote>
  
  <p>But, like I said...unresolved. Resolvable?</p>