]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
fixed undefined div error, added unit tests
authorChristopher De Cairos <chris.decairos@gmail.com>
Tue, 17 May 2011 15:14:49 +0000 (11:14 -0400)
committerChristopher De Cairos <chris.decairos@gmail.com>
Tue, 17 May 2011 15:14:49 +0000 (11:14 -0400)
plugins/facebook/popcorn.facebook.js
plugins/facebook/popcorn.facebook.unit.js

index 9d850bc7675918d247aafcbc3105632c12c66c27..862f213ee169924acc123c1b695791879e908f24 100644 (file)
     * options variable
     */
     start: function( event, options ){
-      options._container.style.display = "inline";
+      var display = function () {
+        if ( options._container ) {
+          options._container.style.display = "inline";
+        } else {
+          setTimeout ( display, 10 ); 
+        }
+      }
+      
+      display();
+      
     },
     /**
     * @member facebook
     * options variable
     */
     end: function( event, options ){
+      var hide = function () {
+        if ( options._container ) {
       options._container.style.display = "none";
+      } else {
+          setTimeout ( hide, 10 ); 
+        }
+      }
+      
+      hide();
     }
   });
 
-})( Popcorn );
\ No newline at end of file
+})( Popcorn );
index 733fccff37609cf47b5f5a90703c7c48c1949048..55148512797b16053db4fecd45ce6c535dca8ce3 100644 (file)
@@ -1,7 +1,7 @@
 test("Popcorn Facebook Plugin", function () {
   
   var popped = Popcorn("#video"),
-      expects = 5,
+      expects = 9,
       count = 0,
       interval,
       interval2,
@@ -51,6 +51,15 @@ test("Popcorn Facebook Plugin", function () {
       } )
     .volume(0)
     .play();
+    
+  ok (document.getElementById('likediv'), "likediv exists on the page" );
+  plus();
+  ok (document.getElementById('likeboxdiv'), "likeboxdiv exists on the page" );
+  plus();
+  ok (document.getElementById('activitydiv'), "activitydiv exists on the page" );
+  plus();
+  ok (document.getElementById('facepilediv'), "facepilediv exists on the page" );
+  plus();
   
   popped.exec( 2, function() {
     ok ( document.getElementById( "likediv" ).innerHTML.length > 0, "No type specified. Like button added to div" );
@@ -71,4 +80,4 @@ test("Popcorn Facebook Plugin", function () {
     ok ( document.getElementById( "facepilediv" ).innerHTML.length > 0, "Facepile is added to div" );
     plus();
   });
-});
\ No newline at end of file
+});