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");
}
测试位移
测试事件
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");
}
测试位移
测试事件
最 近 文 章
- Nosql比较 - Mon, 30 Nov -0001 00:00:00 +0000
- CoreOS试用 - Mon, 30 Nov -0001 00:00:00 +0000
- CentOS 7 常见问题 - Mon, 30 Nov -0001 00:00:00 +0000
- Matrix知识 - Mon, 30 Nov -0001 00:00:00 +0000
- Swift精要 - Mon, 30 Nov -0001 00:00:00 +0000
- Cloud for Coder - Mon, 30 Nov -0001 00:00:00 +0000
- 复杂多维权限系统设计 - Mon, 30 Nov -0001 00:00:00 +0000
- Centos升级到6.5 final出现的PHP错误 - Mon, 30 Nov -0001 00:00:00 +0000
- Session object destruction failed错误 - Mon, 30 Nov -0001 00:00:00 +0000
- 关于自适应图片 - Mon, 30 Nov -0001 00:00:00 +0000