From: ScottDowne Date: Wed, 5 Jan 2011 16:50:53 +0000 (-0500) Subject: [#221] 0.1 XML parser unit test X-Git-Tag: v0.2~18^2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c8304af619fff13981ad13c28777e29345c11a00;p=popcorn-js.git [#221] 0.1 XML parser unit test --- diff --git a/parsers/parserXML/popcorn.parseXML.unit.html b/parsers/parserXML/popcorn.parseXML.unit.html new file mode 100644 index 0000000..05a3383 --- /dev/null +++ b/parsers/parserXML/popcorn.parseXML.unit.html @@ -0,0 +1,43 @@ + + + + Popcorn 0.1 parser Plug-in Test + + + + + + + + + + +

Popcorn 0.1 parser Plug-in Test

+

+
+

+
    +
    + + +
    + + diff --git a/parsers/parserXML/popcorn.parseXML.unit.js b/parsers/parserXML/popcorn.parseXML.unit.js new file mode 100644 index 0000000..e0f47ae --- /dev/null +++ b/parsers/parserXML/popcorn.parseXML.unit.js @@ -0,0 +1,63 @@ +test("Popcorn 0.1 XML Parser Plugin", function () { + + var expects = 7, + count = 0, + timeOut = 0, + interval, + poppercorn = Popcorn( "#video" ); + + function plus() { + if ( ++count === expects ) { + start(); + // clean up added events after tests + clearInterval( interval ); + } + } + + expect(expects); + + stop( 10000 ); + + Popcorn.plugin("parserTest1", { + + start: function ( event, options ) { + ok( options.item2 === "item2", "parserTest1 has data directly from manifest" ); + plus(); + ok( options.item3 === "item3", "parserTest1 has cascading data from manifest" ); + plus(); + }, + end: function ( event, options ) {} + }); + + Popcorn.plugin("parserTest2", { + + start: function ( event, options ) { + ok( options.text === "item4", "parserTest2 has text data" ); + plus(); + ok( options.item1 === "item1", "parserTest2 has cascading data from parent" ); + plus(); + }, + end: function ( event, options ) {} + }); + + Popcorn.plugin("parserTest3", { + + start: function ( event, options ) { + ok( options.item1 === "item1", "parserTest3 has cascading data from parent" ); + plus(); + ok( options.item2 === "item2", "parserTest3 has data directly from manifest" ); + plus(); + ok( options.item3 === "item3", "parserTest3 has cascading data from manifest" ); + plus(); + }, + end: function ( event, options ) {} + }); + + poppercorn.parseXML("unit.XML"); + + // interval used to wait for data to be parsed + interval = setInterval( function() { + poppercorn.currentTime(5).play().currentTime(6); + }, 2000); + +}); diff --git a/parsers/parserXML/unit.XML b/parsers/parserXML/unit.XML new file mode 100644 index 0000000..c7efe8c --- /dev/null +++ b/parsers/parserXML/unit.XML @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + item4 + + + + + +