From 69e9ea6597eb80e1690071cfe0f63c207ba18bd5 Mon Sep 17 00:00:00 2001 From: Christopher De Cairos Date: Tue, 31 May 2011 15:07:38 -0400 Subject: [PATCH] fixed bug t481, created tests to enforce behaviour --- popcorn.js | 3 ++- test/index.html | 1 + test/popcorn.unit.js | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/popcorn.js b/popcorn.js index e2b8de6..4661b1e 100644 --- a/popcorn.js +++ b/popcorn.js @@ -851,7 +851,8 @@ } 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 diff --git a/test/index.html b/test/index.html index 3dde4c0..6fc9947 100644 --- a/test/index.html +++ b/test/index.html @@ -15,6 +15,7 @@ + diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index a45f06f..e6a5fda 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -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 () { -- 2.43.0