Loving Coding & Visual Design

Qunit测试用例

测试动作
function moveLeft(el, px, ms,callback) {
el.animate({
"left": px + "px"
}, {
duration: ms,
complete:callback
});
}
test("move 50", function () {
// expect(2); expect(2);
var el = appendToTest();
ok(el.css('left') == "auto", "element 0");
//define the calback function
var callback = function(){equal(el.css("left"), "50px");start();}
//execute the test:
stop();
moveLeft(el, 50, 200,callback);
});

test("appendElement", function () {
appendToTest()
ok($("#wrapper").find('div'), "element appended");
})

function appendElement(el, to) {
this.el = $("<" + el + "/>");
$(to).append(this.el);
return this.el;
}

function appendToTest() {
return appendElement("div", "#wrapper");
}

测试位移

测试事件



下一页


最 近 文 章

  1. Nosql比较 - Mon, 30 Nov -0001 00:00:00 +0000
  2. CoreOS试用 - Mon, 30 Nov -0001 00:00:00 +0000
  3. CentOS 7 常见问题 - Mon, 30 Nov -0001 00:00:00 +0000
  4. Matrix知识 - Mon, 30 Nov -0001 00:00:00 +0000
  5. Swift精要 - Mon, 30 Nov -0001 00:00:00 +0000
  6. Cloud for Coder - Mon, 30 Nov -0001 00:00:00 +0000
  7. 复杂多维权限系统设计 - Mon, 30 Nov -0001 00:00:00 +0000
  8. Centos升级到6.5 final出现的PHP错误 - Mon, 30 Nov -0001 00:00:00 +0000
  9. Session object destruction failed错误 - Mon, 30 Nov -0001 00:00:00 +0000
  10. 关于自适应图片 - Mon, 30 Nov -0001 00:00:00 +0000