Skip to content

Commit

Permalink
[#494] Adds a test for frame function
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Sep 8, 2011
1 parent 79c1b0f commit 155ac81
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion test/popcorn.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,9 @@ test("Start Zero Immediately", function() {

var $pop = Popcorn("#video"),
expects = 1,
count = 0;
count = 0;

expect(expects);

function plus() {
if ( ++count === expects ) {
Expand All @@ -1479,6 +1481,47 @@ test("Start Zero Immediately", function() {
end: 2
});
});

test("frame function (frameAnimation)", function() {

var $pop = Popcorn("#video", { frameAnimation: true }),
fired = 0,
expects = 1,
count = 0;

expect(expects);

function plus() {
if ( ++count === expects ) {
// clean up added events after tests
Popcorn.removePlugin("frameFn");
start();
}
}

stop();

$pop.pause().currentTime( 1 );

Popcorn.plugin( "frameFn", {
start: function() {
},
frame: function() {
fired++;
},
end: function() {
// if `frame` fired, then it will have value > 0
ok( fired, "frame fired. (actual: " + fired + ")" );
plus();
}
});

$pop.frameFn({
start: 1,
end: 3
}).play();
});

test("Update Timer (timeupdate)", function() {

QUnit.reset();
Expand Down

0 comments on commit 155ac81

Please sign in to comment.