From 840ac214ca9906afba17b7f21ef002ec4ffda7f9 Mon Sep 17 00:00:00 2001 From: ScottDowne Date: Mon, 11 Apr 2011 09:55:00 -0400 Subject: [PATCH] [#356] googlenews plugin tests --- .../googlenews/popcorn.googlenews.unit.html | 43 ++++++++++++++ plugins/googlenews/popcorn.googlenews.unit.js | 59 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 plugins/googlenews/popcorn.googlenews.unit.html create mode 100644 plugins/googlenews/popcorn.googlenews.unit.js 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 -- 2.43.0