From: ScottDowne Date: Mon, 7 Mar 2011 16:59:44 +0000 (-0500) Subject: [#364] split Plugin Factory test module into three modules X-Git-Tag: v0.4~27^2^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=1c8b9a1a66710d0ad7e3a8676fd2c5b441951fdf;p=popcorn-js.git [#364] split Plugin Factory test module into three modules --- diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index d264316..958984e 100755 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -577,28 +577,24 @@ test("Update Timer", function () { test("Plugin Factory", function () { QUnit.reset(); - - // needs expectation var popped = Popcorn("#video"), methods = "load play pause currentTime mute volume roundTime exec removePlugin", - expects = 48, + expects = 34, count = 0; - - //expect(expects); - + function plus() { if ( ++count == expects ) { - Popcorn.removePlugin("breaker"); + //Popcorn.removePlugin("breaker"); Popcorn.removePlugin("executor"); Popcorn.removePlugin("complicator"); - Popcorn.removePlugin("closure"); - start(); + //Popcorn.removePlugin("closure"); + start(); } } + expect( expects ); stop( 10000 ); - expect(expects); Popcorn.plugin("executor", function () { @@ -639,7 +635,7 @@ test("Plugin Factory", function () { ok( "executor" in popped, "executor plugin is now available to instance" ); plus(); - ok( Popcorn.registry.length === 1, "One item in the registry"); + equals( Popcorn.registry.length, 1, "One item in the registry"); plus(); @@ -648,8 +644,7 @@ test("Plugin Factory", function () { start: 1, end: 2 }); - - + Popcorn.plugin("complicator", { start: function ( event ) { @@ -687,18 +682,38 @@ test("Plugin Factory", function () { timeupdate: function () { } }); - - + ok( "complicator" in popped, "complicator plugin is now available to instance" ); plus(); - ok( Popcorn.registry.length === 2, "Two items in the registry"); + equals( Popcorn.registry.length, 2, "Two items in the registry"); plus(); popped.complicator({ start: 3, end: 4 - }); + }); + + popped.currentTime(0).play(); + +}); + +test("Plugin Breaker", function () { + + QUnit.reset(); + + var popped = Popcorn("#video"), + expects = 6, + count = 0; + + function plus() { + if ( ++count == expects ) { + Popcorn.removePlugin("breaker"); + start(); + } + } + expect( expects ); + stop( 10000 ); var breaker = { @@ -735,7 +750,7 @@ test("Plugin Factory", function () { ok( "breaker" in popped, "breaker plugin is now available to instance" ); plus(); - ok( Popcorn.registry.length === 3, "Three items in the registry"); + equals( Popcorn.registry.length, 1, "Three items in the registry"); plus(); popped.breaker({ @@ -743,6 +758,29 @@ test("Plugin Factory", function () { end: 2 }); + popped.currentTime(0).play(); + +}); + +test("Plugin Closure", function () { + + QUnit.reset(); + + var popped = Popcorn("#video"), + methods = "load play pause currentTime mute volume roundTime exec removePlugin", + expects = 8, + count = 0; + + function plus() { + if ( ++count == expects ) { + Popcorn.removePlugin("closure"); + start(); + } + } + + expect( expects ); + stop( 10000 ); + Popcorn.plugin("closure", function() { var startCount = 0; @@ -781,7 +819,7 @@ test("Plugin Factory", function () { nick: "second closure track" }); - popped.currentTime(0).play(); + popped.currentTime(5).play(); });