]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#364] split Plugin Factory test module into three modules
authorScottDowne <sdowne@learn.senecac.on.ca>
Mon, 7 Mar 2011 16:59:44 +0000 (11:59 -0500)
committerScottDowne <sdowne@learn.senecac.on.ca>
Mon, 7 Mar 2011 16:59:44 +0000 (11:59 -0500)
test/popcorn.unit.js

index d2643165f6147d30d3be360ace72fa5d4b94e1c4..958984eebc6d44f010b52ee1213c23677d127bf2 100755 (executable)
@@ -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();
 
 });