在
netTuts.com的QUnit over的介绍产生了一个有趣的交换(从未解决)如何对操纵DOM的操作应用单元测试.以下引用(Alex York)得到了关键:
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?
但是,就像我说的…没有解决.可分解?