]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Fixed white space
authorunknown <Venom@.(none)>
Fri, 11 Feb 2011 22:44:27 +0000 (17:44 -0500)
committerunknown <Venom@.(none)>
Fri, 11 Feb 2011 22:44:27 +0000 (17:44 -0500)
popcorn.js
test/popcorn.unit.js

index 1d07986bcd107c89facadaec5f429092e8dd73a1..e6344ae8e61df8d3e719144618655548b2cbbd91 100644 (file)
   Popcorn.instances = [];
   Popcorn.instanceIds = {};
   
-  Popcorn.removeInstance = function(id) {
+  Popcorn.removeInstance = function( id ) {
     //  If called prior to any instances being created
     //  Return early to avoid splicing on nothing
     if ( !Popcorn.instances.length ) {
+      
       return;
+      
     }
   
     Popcorn.instances.splice( Popcorn.instanceIds[ id ], 1 );
   };
 
   //addes a Popcorn instance to the Popcorn instance array
-  Popcorn.addInstance = function(popcornInstance) {
-    if (!popcornInstance.video.id ) { 
+  Popcorn.addInstance = function( popcornInstance ) {
+  
+    if ( !popcornInstance.video.id ) { 
     
       popcornInstance.video.id = "__popcorn" + Popcorn.instances.length;
     
     }
     
-    Popcorn.instanceIds[popcornInstance.video.id] = Popcorn.instances.length;
+    Popcorn.instanceIds[ popcornInstance.video.id ] = Popcorn.instances.length;
     
-    Popcorn.instances.push(popcornInstance);
+    Popcorn.instances.push( popcornInstance );
     
   };
 
   //User passes in the name of the Popcorn instance and receive a popcorn object
-  Popcorn.getInstanceById = function(name) {
-    return Popcorn.instances[Popcorn.instanceIds[name]];
+  Popcorn.getInstanceById = function( name ) {
+  
+    return Popcorn.instances[ Popcorn.instanceIds[ name ] ];
+    
   };
   
   
       
       
       this.video = elem ? elem : null;
+      
       Popcorn.addInstance(this);
+      
       this.data = {
         history: [],
         events: {},
index 62b0f1ec5f8c129fea27b70974184e3111f45a02..c016b4a3f3ca3e4ba82a941a49ec2ba4426a64db 100644 (file)
@@ -69,37 +69,52 @@ test("Utility", function () {
 });
 
 test("Instances", function() {
-  var popped = Popcorn("#video");
+  var popped =  Popcorn("#video");
   var popped2 = Popcorn("#video");
   var popped3 = Popcorn("#video");
   var expects = 9, 
-      count = 0;
+      count   = 0;
   
   expect(expects);
   
-  function plus(){ if ( ++count == expects ) start(); }
+  function plus(){ 
+    if ( ++count == expects ) {
+      start();      
+    }   
+  }
 
   stop();
+  
   ok( typeof Popcorn.addInstance === "function" , "Popcorn.addInstance is a provided utility function");
   plus();
+  
   ok( typeof Popcorn.removeInstance === "function" , "Popcorn.removeInstance is a provided utility function");
   plus();
+  
   ok( typeof Popcorn.getInstanceById === "function" , "Popcorn.getInstanceById is a provided utility function");
   plus();
+  
   ok( typeof Popcorn.instanceIds === "object" , "Popcorn.instanceIds is a provided cache object");
   plus();
+  
   ok( "length" in Popcorn.instances && "join" in Popcorn.instances, "Popcorn.instances is a provided cache array");  
   plus();
+  
   var instance;
   instance = Popcorn.getInstanceById("video");
+  
   ok( instance.video, "Stored instance as a `video` property" );
-   plus();
+  plus();
+   
   ok( instance.data, "Stored instance as a `data` property" );
-   plus();
+  plus();
+   
   ok( instance instanceof Popcorn, "Instance instanceof Popcorn" );
-   plus();
+  plus();
+   
   ok( 3 === Popcorn.instances.length, "There are the correct number of Popcorn instances" );
-   plus();
+  plus();
+   
 });
 
 test("guid", function () {