forked from stephband/jquery.event.frame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
50 lines (45 loc) · 1.61 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="../../js/qunit/qunit.css" type="text/css" media="screen">
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<script type="text/javascript" src="../../js/jquery-nightly.js"></script>
<script type="text/javascript" src="js/jquery.event.frame.js"></script>
<script type="text/javascript" src="../../js/qunit/qunit.js"></script>
<script type="text/javascript">
test('existence', function(){
ok(jQuery.event.special.frame, 'event.special.frame exists');
});
// Bind a frame, make it stop
var count;
jQuery("h1").bind('frame', {frameDuration: 1000}, function(e){
count = e.frameCount;
jQuery(this).unbind('frame');
});
asyncTest("bind and count", 0, function() {
equals(count, 0, 'Fire frame immediately upon bind');
stop();
// Check first five frameCounts
var i = 0;
jQuery("h1").bind('frame', {frameDuration: 100}, function(e){
if (e.frameCount < 5) {
console.log(e.frameCount);
equals(e.frameCount, i, 'e.frameCount is '+i);
i++;
}
else {
jQuery(this).unbind('frame');
start();
}
});
});
</script>
</body>
</html>