From: ScottDowne Date: Mon, 11 Apr 2011 13:55:00 +0000 (-0400) Subject: [#356] googlenews plugin tests X-Git-Tag: v0.5~27^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=840ac214ca9906afba17b7f21ef002ec4ffda7f9;p=popcorn-js.git [#356] googlenews plugin tests --- diff --git a/plugins/googlenews/popcorn.googlenews.unit.html b/plugins/googlenews/popcorn.googlenews.unit.html new file mode 100644 index 0000000..bf77bca --- /dev/null +++ b/plugins/googlenews/popcorn.googlenews.unit.html @@ -0,0 +1,43 @@ + + + + Popcorn Google News Plug-in Test + + + + + + + + + + +

Popcorn Google News Plugin

+

+
+

+
    +
    + + +
    + + diff --git a/plugins/googlenews/popcorn.googlenews.unit.js b/plugins/googlenews/popcorn.googlenews.unit.js new file mode 100644 index 0000000..7cdfee8 --- /dev/null +++ b/plugins/googlenews/popcorn.googlenews.unit.js @@ -0,0 +1,59 @@ +test( "Popcorn google news Plugin", function () { + + var popped = Popcorn( "#video" ), + expects = 7, + count = 0, + googlenewsdiv = document.getElementById( "googlenewsdiv" ); + + expect(expects); + + function plus() { + if ( ++count===expects ) { + start(); + } + } + + stop(); + + ok ( "googlenews" in popped, "googlenews is a method of the popped instance" ); + plus(); + + equals ( googlenewsdiv.innerHTML, "", "initially, there is nothing inside the googlenewsdiv" ); + plus(); + + popped.googlenews({ + start: 0, // seconds + end: 5, // seconds + topic: "Oil Spill", + target: "googlenewsdiv" + }) + .googlenews({ + start: 3, // seconds + end: 10, // seconds + topic: "Village Telco", + target: "googlenewsdiv" + }) + .volume( 0 ); + + popped.exec( 1, function() { + equals( googlenewsdiv.childElementCount, 2, "googlenewsdiv now has two inner elements" ); + plus(); + equals( googlenewsdiv.children[0].style.display , "inline", "first googlenews is visible on the page" ); + plus(); + }); + + popped.exec( 4, function() { + equals( googlenewsdiv.children[1].style.display , "inline", "second googlenews is visible on the page" ); + plus(); + }); + + popped.exec( 11, function() { + equals( googlenewsdiv.children[1].style.display , "none", "second googlenews is no longer visible on the page" ); + plus(); + equals( googlenewsdiv.children[0].style.display , "none", "first googlenews is no longer visible on the page" ); + plus(); + }); + + popped.play(); + +}); \ No newline at end of file