diff --git a/plugins/twitter/popcorn.twitter.js b/plugins/twitter/popcorn.twitter.js index 66144806..97862101 100755 --- a/plugins/twitter/popcorn.twitter.js +++ b/plugins/twitter/popcorn.twitter.js @@ -97,7 +97,6 @@ width = options.width || 250, height = options.height || 200, profile = /^@/.test( src ), - hash = /^#/.test( src ), widgetOptions = { version: 2, // use this id to connect it to the div @@ -138,7 +137,7 @@ new TWTR.Widget( widgetOptions ).render().setUser( src ).start(); - } else if ( hash ) { + } else { widgetOptions.type = "search"; widgetOptions.search = src; diff --git a/plugins/twitter/popcorn.twitter.unit.js b/plugins/twitter/popcorn.twitter.unit.js index 2feda17f..1cfa4b53 100755 --- a/plugins/twitter/popcorn.twitter.unit.js +++ b/plugins/twitter/popcorn.twitter.unit.js @@ -8,13 +8,15 @@ test( "Popcorn Twitter Plugin", function() { expect( expects ); + Popcorn.plugin.debug = true; + function plus() { if ( ++count === expects ) { start(); } } - stop(); + stop( 20000 ); ok( "twitter" in popped, "twitter is a method of the popped instance" ); plus(); @@ -47,6 +49,7 @@ test( "Popcorn Twitter Plugin", function() { }); popped.exec( 2, function() { + ok( /display: none;/.test( twitterdiv.innerHTML ), "Div contents are hidden again" ); plus(); @@ -56,5 +59,61 @@ test( "Popcorn Twitter Plugin", function() { }); popped.play(); +}); + +test( "Popcorn Twitter Plugin", function() { + + var popped = Popcorn( "#video" ), + expects = 4, + count = 0, + twitterdiv = document.getElementById( "twitterdiv" ); + + expect( expects ); + + Popcorn.plugin.debug = true; + + function plus() { + if ( ++count === expects ) { + start(); + } + } + + stop( 20000 ); + + popped.twitter({ + start: 4, + end: 5, + title: "bieber hash", + src: "#oilspill", + target: "twitterdiv" + }); + + popped.twitter({ + start: 5, + end: 6, + title: "plain text search", + src: "processing.js", + target: "twitterdiv" + }); + + popped.exec( 4, function() { + + ok( /display: inline;/.test( twitterdiv.innerHTML ), "Div contents are displayed" ); + plus(); + ok( /twtr-widget/.test( twitterdiv.innerHTML ), "A Twitter widget exists" ); + plus(); + }); + + popped.exec( 5, function() { + + ok( /display: inline;/.test( twitterdiv.innerHTML ), "Div contents are displayed" ); + plus(); + ok( /twtr-widget/.test( twitterdiv.innerHTML ), "A Twitter widget exists" ); + plus(); + + popped.pause(); + }); + + popped.play( 4 ); });