From: Christopher De Cairos Date: Tue, 17 May 2011 15:14:49 +0000 (-0400) Subject: fixed undefined div error, added unit tests X-Git-Tag: v0.6~2^2~4^2~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=6c1941dbb6f15fba25f04d7614a71ae74cdd99fb;p=popcorn-js.git fixed undefined div error, added unit tests --- diff --git a/plugins/facebook/popcorn.facebook.js b/plugins/facebook/popcorn.facebook.js index 9d850bc..862f213 100644 --- a/plugins/facebook/popcorn.facebook.js +++ b/plugins/facebook/popcorn.facebook.js @@ -176,7 +176,16 @@ * 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 @@ -185,8 +194,16 @@ * 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 ); diff --git a/plugins/facebook/popcorn.facebook.unit.js b/plugins/facebook/popcorn.facebook.unit.js index 733fccf..5514851 100644 --- a/plugins/facebook/popcorn.facebook.unit.js +++ b/plugins/facebook/popcorn.facebook.unit.js @@ -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 +});