]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
fixed bug t481, created tests to enforce behaviour
authorChristopher De Cairos <chris.decairos@gmail.com>
Tue, 31 May 2011 19:07:38 +0000 (15:07 -0400)
committerChristopher De Cairos <chris.decairos@gmail.com>
Tue, 31 May 2011 19:07:38 +0000 (15:07 -0400)
popcorn.js
test/index.html
test/popcorn.unit.js

index e2b8de6b97bc3ac11c9c2ea4714220b100f86046..4661b1ee161e688e5f38d98ce33935fe9865984d 100644 (file)
       }
 
       if ( !( "end" in options ) ) {
-        options.end = this.duration();
+        var duration = this.duration();
+        options.end = duration ? duration : Number.MAX_VALUE;
       }
 
       //  If a _setup was declared, then call it before
index 3dde4c0fb889957cf8b17311a4788aedc4ef8b87..6fc99477f180a64cd1005a11e13b41e4698f7432 100644 (file)
@@ -15,6 +15,7 @@
   <script src="popcorn.unit.setup.js"></script>
   
   <script src="../popcorn.js"></script>
+  <script src="../players/baseplayer/popcorn.baseplayer.js"></script>
   <script src="popcorn.unit.js"></script>
 </head>
 <body>
index a45f06f71729fd79c3e65f8930c9e3660025609d..e6a5fda1d94c7ea9fc74f0c1aa10766e9be2f105 100644 (file)
@@ -1498,6 +1498,39 @@ test("Protected Names", function () {
   });
 });
 
+test("Defaulting Empty End Values", function() {
+  
+  expect (2);
+  
+  Popcorn.plugin("testdefault", {
+    _setup: function( options ) {
+      equals( options.end, Number.MAX_VALUE, "The end value defaulted to maximum number value");
+    },
+    start: function(event, options) {
+
+    },
+    end: function(event, options) {
+
+    }
+  });
+  
+  var popped = Popcorn( Popcorn.baseplayer() )
+  .play() 
+  .testdefault({
+    start: 0, // seconds
+    apikey: "CHAyhB5IisvLqqzGYNYbmA",
+    mediaid: "13607892"
+  });
+
+  var popped2 = Popcorn(document.createElement("video"))
+  .play()
+  .testdefault({
+    start: 0, // seconds
+    apikey: "CHAyhB5IisvLqqzGYNYbmA",
+    mediaid: "13607892"
+  });
+});
+
 module("Popcorn TrackEvents");
 test("Functions", function () {