From a437273d8ca6068fee0c9b29000bfb8b0d67a163 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 26 Sep 2011 12:00:32 -0400 Subject: [PATCH 1/2] [#737] Fixes borked tests --- test/popcorn.unit.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index 7ea4a844c..8cbe75581 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -589,10 +589,10 @@ test( "play(n)/pause(n) custom stop()", function() { }; var outerHTML = [ - "" - ].join( "\n" ), + "" + ].join( "\n" ), count = 0, expects = 2, $pop; @@ -1911,6 +1911,7 @@ test("timeUpdate add track event while paused", function() { function plus() { if ( ++count === expects ) { Popcorn.removePlugin( "timeUpdateTester" ); + start(); } } @@ -1928,15 +1929,16 @@ test("timeUpdate add track event while paused", function() { }; }); - $pop.currentTime(40).pause(); + stop(); + $pop.currentTime( 1 ).pause(); equals( $pop.getTrackEvents().length, 0, "Initially no trackEvents" ); plus(); $pop.timeUpdateTester({ - id:"timeUpdateID", - start:40, - end: 41 + id: "timeUpdateID", + start: 1, + end: 1 }); equals( $pop.getTrackEvents().length, 1, "trackEvent successfully added" ); @@ -3050,7 +3052,7 @@ test( "Popcorn.disable/enable/toggle (timeupdate)", function() { stop( 10000 ); - $pop.currentTime( 39 ).play(); + $pop.currentTime( 39 ).play(); }); module("Popcorn XHR"); From 342d26c48d3b58fdba04b7a6610a92c3c2481ac4 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 26 Sep 2011 12:07:58 -0400 Subject: [PATCH 2/2] [#737] Test re-write --- test/popcorn.unit.js | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index 8cbe75581..841707b65 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -1904,7 +1904,7 @@ test("timeUpdate add track event while paused", function() { var $pop = Popcorn( "#video" ), count = 0, - expects = 3; + expects = 1; expect( expects ); @@ -1915,40 +1915,25 @@ test("timeUpdate add track event while paused", function() { } } - Popcorn.plugin("timeUpdateTester", function() { + stop(); + + Popcorn.plugin( "timeUpdateTester", function() { return { start: function () { - var div = document.createElement("div"); - div.id = "timeUpdate-test"; - - document.body.appendChild(div); + ok( true, "timeupdater ran while paused"); + plus(); }, end: function () { - document.getElementById("timeUpdate-test").parentNode.removeChild(document.getElementById("timeUpdate-test")); } }; }); - stop(); - $pop.currentTime( 1 ).pause(); - - equals( $pop.getTrackEvents().length, 0, "Initially no trackEvents" ); - plus(); + $pop.currentTime( 1 ).pause() $pop.timeUpdateTester({ - id: "timeUpdateID", start: 1, - end: 1 + end: 2 }); - - equals( $pop.getTrackEvents().length, 1, "trackEvent successfully added" ); - plus(); - - ok( document.getElementById( "timeUpdate-test" ), "trackEvent successfully added, content was displayed while video was paused" ); - plus(); - - $pop.removeTrackEvent( "timeUpdateID" ); - }); test("Plugin Factory", function () {