]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#173]
authorrwldrn <waldron.rick@gmail.com>
Sun, 5 Dec 2010 01:20:49 +0000 (20:20 -0500)
committerrwldrn <waldron.rick@gmail.com>
Sun, 5 Dec 2010 01:20:49 +0000 (20:20 -0500)
popcorn.js
test/demo.js
test/popcorn-api-draft-unit.js

index 853838b9f7c5d01a39b3d600fd49fc52e56ec329..429d1142f4efdce4600555c7aa20184342385cc9 100644 (file)
         }
         
         
-        this.video.addEventListener( "timeupdate", function( event ) {
+        this.listen( "timeupdate", function( event ) {
           
           
           if ( ~~self.currentTime() === options.start || 
index 281b497b7b7e8f0121ef64c03851fe98e24adc7a..c4a5a9bf0fea16521bdf47a871d6dbf459a11ab1 100644 (file)
@@ -155,7 +155,8 @@ $(function () {
   
   p.complicator({
     start: 1, 
-    end: 10
+    end: 10, 
+    wtf: "throws exception?"
   });
 
   
index b2f777626c8669e40c75321b4e335569375324d1..d13c5acf367add8cbd4c8360b1f1bb02121b1278 100644 (file)
@@ -71,102 +71,6 @@ test("Popcorn Object", function () {
 });
 
 
-test("Popcorn Plugin", function () {
-  
-  QUnit.reset();
-  
-  // needs expectation
-
-  var popped = Popcorn("#video"), 
-      methods = "load play pause currentTime mute volume";
-      
-  
-  stop();
-  
-  
-  Popcorn.plugin("subtitles", function () {
-    
-    var self = this;
-    
-    // These ensure that a popcorn instance is the value of `this` inside a plugin definition
-    
-    methods.split(/\s+/g).forEach(function (k,v) {
-      ok( k in self, "instance has method: " + k );
-    });
-
-    ok( "video" in this, "instance has `video` property" );
-    ok( Object.prototype.toString.call(popped.video) === "[object HTMLVideoElement]", "video property is a HTMLVideoElement" );
-
-    ok( "data" in this, "instance has `data` property" );
-    ok( Object.prototype.toString.call(popped.data) === "[object Object]", "data property is an object" );
-
-    ok( "tracks" in this.data, "instance has `tracks` property" );
-    ok( Object.prototype.toString.call(popped.data.tracks) === "[object Array]", "tracks property is an array" )
-  });
-  
-  
-  //  Call plugin to test scope within 
-  popped.subtitles();
-  
-  
-  
-  ok( "subtitles" in popped, "subtitles plugin is now available to instance" );
-  ok( Popcorn.registry.length === 1, "One item in the registry");
-  
-  
-  
-  
-  
-  Popcorn.plugin("complicator", {
-    
-    start: function ( event ) {
-      
-      
-      equals( ~~this.currentTime(), 1, "~~this.currentTime() === 1");
-      
-      var self = this;
-
-      // These ensure that a popcorn instance is the value of `this` inside a plugin definition
-
-      methods.split(/\s+/g).forEach(function (k,v) {
-        ok( k in self, "instance has method: " + k );
-      });
-
-      ok( "video" in this, "instance has `video` property" );
-      ok( Object.prototype.toString.call(popped.video) === "[object HTMLVideoElement]", "video property is a HTMLVideoElement" );
-
-      ok( "data" in this, "instance has `data` property" );
-      ok( Object.prototype.toString.call(popped.data) === "[object Object]", "data property is an object" );
-
-      ok( "tracks" in this.data, "instance has `tracks` property" );
-      ok( Object.prototype.toString.call(popped.data.tracks) === "[object Array]", "tracks property is an array" )      
-      
-    },
-    end: function () {
-    
-      start();
-    
-    }, 
-    timeupdate: function () {
-    }    
-  });
-  
-  
-  ok( "complicator" in popped, "complicator plugin is now available to instance" );
-  ok( Popcorn.registry.length === 2, "Two items in the registry");
-  
-  
-  
-  popped.currentTime(0);
-  
-  popped.complicator({
-    start: 1, 
-    end: 2
-  });  
-  
-  
-});
-
 test("Popcorn Events Stored By Type", function () {
   
   QUnit.reset();
@@ -226,6 +130,8 @@ test("Popcorn Events Stored By Type", function () {
   
   p.trigger("play");
   
+  p.unlisten("play");
+  
 });
 
 
@@ -276,7 +182,8 @@ test("Popcorn Events Simulated", function () {
 
 
 test("Popcorn Events Real", function () {
-
+  
+  QUnit.reset();
 
   var p = Popcorn("#video"),
       completed = [], 
@@ -286,7 +193,7 @@ test("Popcorn Events Real", function () {
       events = eventtest.split(/\s+/g);                              
   
   
-  var expects = events.length, 
+  var expects = 11, 
       count = 0;
 
   //expect(expects);
@@ -326,16 +233,100 @@ test("Popcorn Events Real", function () {
 
   
   
+});
+
+test("Popcorn Plugin", function () {
+  
+  QUnit.reset();
+  
+  // needs expectation
+
+  var popped = Popcorn("#video"), 
+      methods = "load play pause currentTime mute volume";
+      
   
-  setTimeout(function() {
+  stop();
   
-    //console.log(completed);
   
-    start();
+  Popcorn.plugin("subtitles", function () {
+    
+    var self = this;
     
-  }, 5000);
+    // These ensure that a popcorn instance is the value of `this` inside a plugin definition
+    
+    methods.split(/\s+/g).forEach(function (k,v) {
+      ok( k in self, "instance has method: " + k );
+    });
+
+    ok( "video" in this, "instance has `video` property" );
+    ok( Object.prototype.toString.call(popped.video) === "[object HTMLVideoElement]", "video property is a HTMLVideoElement" );
+
+    ok( "data" in this, "instance has `data` property" );
+    ok( Object.prototype.toString.call(popped.data) === "[object Object]", "data property is an object" );
+
+    ok( "tracks" in this.data, "instance has `tracks` property" );
+    ok( Object.prototype.toString.call(popped.data.tracks) === "[object Array]", "tracks property is an array" )
+  });
   
   
+  //  Call plugin to test scope within 
+  popped.subtitles();
   
-});
+  
+  
+  ok( "subtitles" in popped, "subtitles plugin is now available to instance" );
+  ok( Popcorn.registry.length === 1, "One item in the registry");
+  
+  
+  
+  
+  
+  Popcorn.plugin("complicator", {
+    
+    start: function ( event ) {
+      
+      
+      equals( ~~this.currentTime(), 1, "~~this.currentTime() === 1");
+      
+      var self = this;
+
+      // These ensure that a popcorn instance is the value of `this` inside a plugin definition
+
+      methods.split(/\s+/g).forEach(function (k,v) {
+        ok( k in self, "instance has method: " + k );
+      });
+
+      ok( "video" in this, "instance has `video` property" );
+      ok( Object.prototype.toString.call(popped.video) === "[object HTMLVideoElement]", "video property is a HTMLVideoElement" );
+
+      ok( "data" in this, "instance has `data` property" );
+      ok( Object.prototype.toString.call(popped.data) === "[object Object]", "data property is an object" );
 
+      ok( "tracks" in this.data, "instance has `tracks` property" );
+      ok( Object.prototype.toString.call(popped.data.tracks) === "[object Array]", "tracks property is an array" )      
+      
+    },
+    end: function () {
+    
+      start();
+    
+    }, 
+    timeupdate: function () {
+    }    
+  });
+  
+  
+  ok( "complicator" in popped, "complicator plugin is now available to instance" );
+  ok( Popcorn.registry.length === 2, "Two items in the registry");
+  
+  
+  
+  popped.currentTime(0);
+  
+  popped.complicator({
+    start: 1, 
+    end: 2
+  });  
+  
+  
+});
\ No newline at end of file