Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Fixes to tests for quirks in all browsers (but mostly IE9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher De Cairos committed Jan 16, 2013
1 parent ead68ae commit c4d3065
Show file tree
Hide file tree
Showing 29 changed files with 471 additions and 317 deletions.
17 changes: 12 additions & 5 deletions test/core/plugin/plugin-add-trackevent-paused.html
Expand Up @@ -25,12 +25,19 @@
};
});

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

$pop.timeUpdateTester({
start: 1,
end: 3
$pop.on( "canplayall", function onReady() {
this.off( "canplayall", onReady )
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
$pop.timeUpdateTester({
start: 1,
end: 3
});
});
this.pause();
this.currentTime( 2 );
});

});
</script>
</head>
Expand Down
10 changes: 9 additions & 1 deletion test/core/plugin/plugin-breaker.html
Expand Up @@ -62,7 +62,15 @@
end: 2
});

popped.currentTime( 0 ).play();
popped.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 0 );
});

});
</script>
</head>
Expand Down
15 changes: 13 additions & 2 deletions test/core/plugin/plugin-closure.html
Expand Up @@ -47,7 +47,11 @@
plus();

// running tracks again to make sure data increments uniquly
popped.currentTime( 5 ).play();
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 5 );
}
};
});
Expand All @@ -63,7 +67,14 @@
nick: "second closure track"
});

popped.currentTime( 5 ).play();
popped.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 5 );
});

});
</script>
Expand Down
11 changes: 10 additions & 1 deletion test/core/plugin/plugin-configurable-defaults.html
Expand Up @@ -165,7 +165,16 @@
end: 5,
target: "custom",
text: "hello!"
}).currentTime( 2 ).play();
})

p.on( "canplayall", function onReady() {
this.off( "canplayall", onReady )
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 2 );
});
});
</script>
</head>
Expand Down
10 changes: 9 additions & 1 deletion test/core/plugin/plugin-empty.html
Expand Up @@ -38,7 +38,15 @@
ok( testObj._teardown, "default _teardown function is generated" );
plus();

popped.currentTime( 0 ).play();
popped.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 0 );
});

});
</script>
</head>
Expand Down
9 changes: 8 additions & 1 deletion test/core/plugin/plugin-factory.html
Expand Up @@ -114,7 +114,14 @@
end: 5
});

popped.currentTime( 0 ).play();
popped.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 0 );
});
});
</script>
</head>
Expand Down
34 changes: 23 additions & 11 deletions test/core/plugin/plugin-frame-fn-raf.html
Expand Up @@ -25,8 +25,6 @@
start();
}

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

Popcorn.plugin( "frameFn", {
start: function() {
},
Expand All @@ -40,17 +38,31 @@
}
});

$pop.frameFn({
start: 1,
end: 3
}).play();
$pop.on( "canplayall", function onReady() {
this.off( "canplayall", onReady )

timeout = setTimeout(function() {
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );

this.frameFn({
start: 1,
end: 3
});

this.play();

timeout = setTimeout(function() {

ok( true, "IE9 has trouble with this rAF test, skipping" );
Popcorn.removePlugin( "frameFn" );
start();
}, 10000 );

});
this.pause();
this.currentTime( 1 );
});

ok( true, "IE9 has trouble with this rAF test, skipping" );
Popcorn.removePlugin( "frameFn" );
start();
}, 10000 );
});
</script>
</head>
Expand Down
11 changes: 8 additions & 3 deletions test/core/plugin/plugin-in-out-alias.html
Expand Up @@ -41,11 +41,16 @@
out: 3
});

popcorn.listen( "seeked", function() {
this.off( "seeked" ).play( 0 );

popcorn.on( "canplayall", function onReady() {
this.listen( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play( 0 );
});
this.off( "canplayall", onReady );
this.currentTime( 0 );
});

popcorn.currentTime( 0 );

ok( popcorn.data.events[ "in" ], "in is a valid alias for start" );
plus();
Expand Down
13 changes: 9 additions & 4 deletions test/core/plugin/plugin-instance-integrity-natives.html
Expand Up @@ -32,15 +32,20 @@
});

p.cue( 4.5, function() {
Popcorn.removePlugin( "integrityTest" );
p.currentTime( 0 );
p.destroy();
start();
});

p.integrityTest( id, { start: 1, end: 4 } );
p.integrityTest( id, { start: 3 } );
p.play( 2 );

p.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 2 );
});
});
</script>
</head>
Expand Down
28 changes: 15 additions & 13 deletions test/core/plugin/plugin-ranges.html
Expand Up @@ -8,7 +8,7 @@
<script src="../../../popcorn.js"></script>
<script src="../../popcorn.inject.js"></script>
<script>
test( "Range of track events #1015", 2, function() {
asyncTest( "Range of track events #1015", 2, function() {

var $pop = Popcorn( "#video" );

Expand All @@ -17,20 +17,22 @@
end: function() {}
});

$pop.ranger({
text: "I will appear at 3 different times",
ranges: [
{ start: 15, end: 16 },
{ start: 18, end: 19 },
{ start: 21, end: 22 }
]
});
$pop.on( "canplayall", function onReady() {
$pop.ranger({
text: "I will appear at 3 different times",
ranges: [
{ start: 15, end: 16 },
{ start: 18, end: 19 },
{ start: 21, end: 22 }
]
});

equal( $pop.data.trackEvents.byStart.length, 5, "There are 5 start track events (2 padding events, 3 custom event)" );
equal( $pop.data.trackEvents.byEnd.length, 5, "There are 5 end track events (2 padding events, 3 custom event)" );
equal( $pop.data.trackEvents.byStart.length, 5, "There are 5 start track events (2 padding events, 3 custom event)" );
equal( $pop.data.trackEvents.byEnd.length, 5, "There are 5 end track events (2 padding events, 3 custom event)" );

Popcorn.removePlugin( "ranger" );
$pop.destroy();
Popcorn.removePlugin( "ranger" );
start();
});
});
</script>
</head>
Expand Down
12 changes: 10 additions & 2 deletions test/core/plugin/plugin-removal.html
Expand Up @@ -138,10 +138,18 @@
});
p2.removeTrackEvent( p2.getLastTrackEventId() );

p2.currentTime( 2 ).play();
p2.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
p2.currentTime( 2 );
});

p.currentTime( 0 ).pause();
p.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.pause();
this.currentTime( 0 );
});

});
</script>
Expand Down
15 changes: 11 additions & 4 deletions test/core/plugin/plugin-teardown-end-noise.html
Expand Up @@ -58,11 +58,18 @@
popped.noise({end: 21});
popped.teardownEndTester({end: 20});

popped.currentTime( 0 ).play();
popped.removePlugin( "teardownEndTester" );
popped.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
popped.removePlugin( "teardownEndTester" );
equal( popped.data.trackEvents.byEnd[ 1 ]._natives.type, "noise", "proper end was removed" );
plus();
});
this.currentTime( 0 );
});

equal( popped.data.trackEvents.byEnd[ 1 ]._natives.type, "noise", "proper end was removed" );
plus();
});
</script>
</head>
Expand Down
11 changes: 9 additions & 2 deletions test/core/plugin/plugin-teardown-end-tester.html
Expand Up @@ -53,8 +53,15 @@
// to ensure the end function will never be called outside of _teardown
popped.teardownEndTester({});

popped.currentTime( 0 ).play();
popped.removePlugin( "teardownEndTester" );
popped.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
popped.removePlugin( "teardownEndTester" );
});
this.currentTime( 0 );
});
});
</script>
</head>
Expand Down
13 changes: 8 additions & 5 deletions test/core/plugin/plugin-update-timer-raf.html
Expand Up @@ -30,7 +30,7 @@
backwardEnd = false,
wrapperRunning = {
one: false,
two: false,
two: false
};

function plus() {
Expand Down Expand Up @@ -178,12 +178,15 @@
}
});

p2.on( "seeked", function onSeeked() {
p2.off( "seeked", onSeeked );
this.play();
p2.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 3 );
});

p2.currentTime( 3 );
});
</script>
</head>
Expand Down
14 changes: 8 additions & 6 deletions test/core/plugin/plugin-update-timer-tu.html
Expand Up @@ -27,11 +27,6 @@

function plus() {
if ( ++count === expects ) {
// clean up added events after tests
Popcorn.removePlugin( "forwards" );
Popcorn.removePlugin( "backwards" );
Popcorn.removePlugin( "wrapper" );
p2.destroy();
start();
}
}
Expand Down Expand Up @@ -170,7 +165,14 @@
}
});

p2.currentTime( 3 ).play();
p2.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.on( "seeked", function onSeeked() {
this.off( "seeked", onSeeked );
this.play();
});
this.currentTime( 3 );
});
});
</script>
</head>
Expand Down
7 changes: 6 additions & 1 deletion test/core/plugin/plugin-zero-start.html
Expand Up @@ -12,7 +12,12 @@

var $pop = Popcorn( "#video" );

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

$pop.on( "canplayall", function onReady() {
this.off( "canplayall", onReady );
this.pause();
this.currentTime( 0 );
});

Popcorn.plugin( "zero", {
start: function() {
Expand Down

0 comments on commit c4d3065

Please sign in to comment.