]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#273] Adds unit test to 273 fix
authorrwldrn <waldron.rick@gmail.com>
Fri, 21 Jan 2011 20:10:11 +0000 (15:10 -0500)
committerrwldrn <waldron.rick@gmail.com>
Fri, 21 Jan 2011 20:10:11 +0000 (15:10 -0500)
popcorn.js
test/data/parseMissing.json [new file with mode: 0644]
test/popcorn.unit.js

index 21a0ed26bbcb50e97e7b744598e26994825c93ad..87c06dbdbfc0e1b339d5cbe37e9ca12526d20a43 100644 (file)
     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 (file)
index 0000000..fa7d212
--- /dev/null
@@ -0,0 +1,10 @@
+{\r
+  "data": [\r
+    {\r
+      "parserMissing": {\r
+        "start": 5,\r
+        "end": 6\r
+      }\r
+    }\r
+  ]\r
+}\r
index 9288cc3c171006c17037725f77ff2ead152e1bac..ac2bfea081c503972f3e1413c4c2d5301a5b5a00 100644 (file)
@@ -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 () {