From: rwldrn Date: Fri, 21 Jan 2011 20:10:11 +0000 (-0500) Subject: [#273] Adds unit test to 273 fix X-Git-Tag: v0.3~20^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=9c5fc92c8ae8b0c7aa5c59e7ce9c2c1fe65f3396;p=popcorn-js.git [#273] Adds unit test to 273 fix --- diff --git a/popcorn.js b/popcorn.js index 21a0ed2..87c06db 100644 --- a/popcorn.js +++ b/popcorn.js @@ -806,7 +806,7 @@ Popcorn.extend( Popcorn.p, parser ); // keys the function name by filetype extension - Popcorn.parsers[type] = name; + Popcorn.parsers[ type ] = name; return parser; }; diff --git a/test/data/parseMissing.json b/test/data/parseMissing.json new file mode 100644 index 0000000..fa7d212 --- /dev/null +++ b/test/data/parseMissing.json @@ -0,0 +1,10 @@ +{ + "data": [ + { + "parserMissing": { + "start": 5, + "end": 6 + } + } + ] +} diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index 9288cc3..ac2bfea 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -1357,6 +1357,47 @@ test("Parsing Integrity", function () { }); +test("Parsing Handler - References unavailable plugin", function () { + + var expects = 1, + count = 0, + timeOut = 0, + interval, + poppercore = Popcorn( "#video" ); + + function plus() { + if ( ++count === expects ) { + start(); + // clean up added events after tests + clearInterval( interval ); + poppercore.removePlugin( "parserTest" ); + } + } + + expect(expects); + + stop(); + + Popcorn.parser( "parseJson" , "json", function( data ){ + + return data.json; + }); + + poppercore.parseJson("data/parseMissing.json"); + + // interval used to wait for data to be parsed + interval = setInterval( function() { + poppercore.currentTime(5).play().currentTime(6); + + ok( true, "Ignored call to missing plugin " ); + plus(); + + }, 2000); + +}); + + + module("Popcorn Test Runner End"); test("Last Check", function () {