]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Unit test cleanup
authorrwldrn <waldron.rick@gmail.com>
Sun, 5 Dec 2010 17:52:04 +0000 (12:52 -0500)
committerrwldrn <waldron.rick@gmail.com>
Sun, 5 Dec 2010 17:52:04 +0000 (12:52 -0500)
popcorn.js
test/popcorn.unit.js

index 13d697a3f5ffa234f45aea76367bf519488d1738..bf658b13fc11c0e6f21bebf02ce7b02a1c1708b1 100644 (file)
@@ -1,9 +1,3 @@
-//  Immediately invoked function expression is used to 
-//  create a pseudo-private scope for our api definition
-//  a reference to the `window` object is passed into the
-//  closure and referenced as `global`. This is both 
-//  beneficial for compressors and provides a fast 
-//  reference to the window context
 (function(global) {
 
   //  Cache refs to speed up calls to native utils
 
       definition  = function ( options ) {
         
-        var self = this;
+        var self = this, 
+            fired = {
+              start: 0, 
+              end: 0
+            };
         
         if ( !options ) {
           return this;
           
           if ( ~~self.currentTime() === options.start || 
                   self.currentTime() === options.start ) {
-          
-            setup.start.call(self, event, options);
+            
+            !fired.start && setup.start.call(self, event, options);
+            
+            fired.start++;
           }
 
           if ( self.currentTime() > options.start && 
           if ( ~~self.currentTime() === options.end || 
                   self.currentTime() === options.end ) {
                 
-            setup.end.call(self, event, options);
+            !fired.end && setup.end.call(self, event, options);
+            
+            fired.end++;
           }
           
         });
index 9162feb6b240c790e0b5b905128b038ae2e6250a..6da487709a50fb2160ff520e279b43f008ed88be 100644 (file)
@@ -1,4 +1,6 @@
-test("Popcorn API", function () {
+
+module("Popcorn");
+test("API", function () {
   
   var expects = 3, 
       count = 0;
@@ -35,21 +37,28 @@ test("Popcorn API", function () {
   
 });
 
-test("Popcorn Utility", function () {
+test("Utility", function () {
+  
+  //  TODO: comprehensive tests for these utilities
   
   equals( typeof Popcorn.forEach, "function" , "Popcorn.forEach is a provided utility function");
   equals( typeof Popcorn.extend, "function" , "Popcorn.extend is a provided utility function");
+  equals( typeof Popcorn.guid, "function" , "Popcorn.guid is a provided utility function");
+  equals( typeof Popcorn.sizeOf, "function" , "Popcorn.sizeOf is a provided utility function");
+  equals( typeof Popcorn.nop, "function" , "Popcorn.nop is a provided utility function");
 
 });
 
 
-test("Popcorn Object", function () {
+test("Object", function () {
 
   
   var popped = Popcorn("#video"), 
       methods = "load play pause currentTime mute volume";
   
-  //console.log(popped);
+  
+  
+  console.log(popped);
   
   popped.play();
 
@@ -70,8 +79,9 @@ test("Popcorn Object", function () {
   
 });
 
+module("Popcorn Events");
 
-test("Popcorn Events Stored By Type", function () {
+test("Stored By Type", function () {
   
   QUnit.reset();
   
@@ -135,7 +145,7 @@ test("Popcorn Events Stored By Type", function () {
 });
 
 
-test("Popcorn Events Simulated", function () {
+test("Simulated", function () {
   
   QUnit.reset();
   
@@ -177,7 +187,7 @@ test("Popcorn Events Simulated", function () {
 });
 
 
-test("Popcorn Events Real", function () {
+test("Real", function () {
   
   QUnit.reset();
 
@@ -227,7 +237,8 @@ test("Popcorn Events Real", function () {
   
 });
 
-test("Popcorn Plugin", function () {
+module("Popcorn Plugin")
+test("Plugin API", function () {
   
   QUnit.reset();
   
@@ -347,22 +358,7 @@ test("Popcorn Plugin", function () {
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-test("Popcorn Plugin Extended Events", function () {
+test("Events Extended", function () {
   
   //QUnit.reset();