]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#734] Added _teardown method. Added unit tests for _teardown.
authorMatthew Schranz <schranz.m@gmail.com>
Wed, 28 Sep 2011 23:12:14 +0000 (19:12 -0400)
committerMatthew Schranz <schranz.m@gmail.com>
Wed, 28 Sep 2011 23:12:14 +0000 (19:12 -0400)
plugins/facebook/popcorn.facebook.js
plugins/facebook/popcorn.facebook.unit.js

index 0ae26b97d46cb18fc23b1771444113d784a9d3f6..2ec920b54bb2ae70876f5f78c61b021e4ed2fdc1 100755 (executable)
@@ -46,7 +46,7 @@
   * This will show how many people "like" Seneca College's Facebook page, and show their profile pictures
   */
 
-  var ranOnce = false, idx = 0;
+  var ranOnce = false;
 
   Popcorn.plugin( "facebook" , {
     manifest: {
     _setup: function( options ) {
 
       var target = document.getElementById( options.target ),
-          _type = options.type,
-          facebookdiv;
-      
-      /*
-      // Ensure target container chosen by user exists
-      if ( !target && Popcorn.plugin.debug ) {
-        throw new Error( "Facebook target container doesn't exist" );
-      }
-      target && target.appendChild( containerDiv );
-      */
-      
+          _type = options.type;
+
       // facebook script requires a div named fb-root
       if ( !document.getElementById( "fb-root" ) ) {
         var fbRoot = document.createElement( "div" );
     },
     _teardown: function( options ){
       var target = document.getElementById( options.target );
-      target && target.removeChild( options._facebookdiv );
+      target && target.removeChild( options._container );
     }
   });
 
-})( Popcorn, this );
\ No newline at end of file
+})( Popcorn, this );
index 5d70e653036c445bb01b9e4096e577e31ec29367..8602fb81b120cf7034a9ee9aa0824e5f2bbf92f7 100755 (executable)
@@ -39,7 +39,7 @@ test( "Popcorn Facebook Plugin", function () {
   })
   .volume( 0 )
   .play();
-  
+
   setupId = popped.getLastTrackEventId();
 
   ok ( document.getElementById( "activitydiv" ), "activitydiv exists on the page" );
@@ -57,12 +57,12 @@ test( "Popcorn Facebook Plugin", function () {
   popped.exec( 5, function() {
     ok( document.getElementById( "facepilediv" ).innerHTML, "Facepilediv is not empty at 0:05 (expected)" );
     plus();
-    
+
     popped.pause().removeTrackEvent( setupId );
-    ok( !facepilediv, "removed facebook social plugin was properly destroyed" );
+    ok( !document.getElementById( "facepilediv" ).innerHTML, "removed facebook social plugin was properly destroyed" );
     plus();
   });
-  
+
 });