From 9c5fc92c8ae8b0c7aa5c59e7ce9c2c1fe65f3396 Mon Sep 17 00:00:00 2001 From: rwldrn Date: Fri, 21 Jan 2011 15:10:11 -0500 Subject: [PATCH] [#273] Adds unit test to 273 fix --- popcorn.js | 2 +- test/data/parseMissing.json | 10 +++++++++ test/popcorn.unit.js | 41 +++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 test/data/parseMissing.json 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 () { -- 2.43.0