From a878c9a55460db320186d986f953198a95bc284f Mon Sep 17 00:00:00 2001 From: David Seifried Date: Tue, 21 Jun 2011 14:40:21 -0400 Subject: [PATCH] [#384] Fixed linting error and options.diretion not being defined issue, unit tests work once again --- plugins/timeline/popcorn.timeline.js | 7 +++++-- plugins/timeline/popcorn.timeline.unit.js | 24 +++++++++++------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/plugins/timeline/popcorn.timeline.js b/plugins/timeline/popcorn.timeline.js index b9d6f67..4d56204 100644 --- a/plugins/timeline/popcorn.timeline.js +++ b/plugins/timeline/popcorn.timeline.js @@ -47,8 +47,11 @@ newdiv.style.display = "none"; newdiv.id = "timelineDiv" + i; - options.direction = ( options.direction.toLowerCase() === "up" || options.direction.toLowerCase() === "down" ) - ? options.direction : "up"; + // Default to up if options.direction is non-existant or not up or down + options.direction = options.direction || "up"; + if ( options.direction.toLowerCase() !== "up" || options.direction.toLowerCase() !== "down" ) { + options.direction = "up"; + } if ( target ) { diff --git a/plugins/timeline/popcorn.timeline.unit.js b/plugins/timeline/popcorn.timeline.unit.js index 852ba78..cd680d5 100644 --- a/plugins/timeline/popcorn.timeline.unit.js +++ b/plugins/timeline/popcorn.timeline.unit.js @@ -1,23 +1,23 @@ test("Popcorn Timeline Plugin", function () { - var popped = Popcorn("#video"), + var popped = Popcorn( "#video" ), expects = 8, setupId, count = 0; - expect(expects); + expect( expects ); function plus() { - if ( ++count===expects) { + if ( ++count === expects ) { start(); } } stop(); - ok ('timeline' in popped, "timeline is a method of the popped instance"); + ok ( 'timeline' in popped, "timeline is a method of the popped instance" ); plus(); - ok ( document.getElementById('timeline').innerHTML === "", "initially, there is nothing inside the feed" ); + ok ( document.getElementById( 'timeline' ).innerHTML === "", "initially, there is nothing inside the feed" ); plus(); popped.timeline({ @@ -39,24 +39,24 @@ test("Popcorn Timeline Plugin", function () { setupId = popped.getLastTrackEventId(); popped.exec( 2, function() { - ok (document.getElementById('timelineDiv1'), "First timeline is on the page" ); + ok ( document.getElementById( 'timelineDiv1' ), "First timeline is on the page" ); plus(); - equals (document.getElementById('timelineDiv1').parentNode.id, "timeline", "First timeline is inside the 'timeline' div" ); + equals ( document.getElementById('timelineDiv1' ).parentNode.id, "timeline", "First timeline is inside the 'timeline' div" ); plus(); }); popped.exec( 3, function() { - ok (document.getElementById('timelineDiv2'), "Second timeline is on the page" ); + ok ( document.getElementById( 'timelineDiv2' ), "Second timeline is on the page" ); plus(); - equals (document.getElementById('timelineDiv2').parentNode.id, "timeline", "Second timelineDiv2 is inside the 'timeline' div" ); + equals ( document.getElementById( 'timelineDiv2' ).parentNode.id, "timeline", "Second timelineDiv2 is inside the 'timeline' div" ); plus(); }); popped.exec( 4, function() { - ok (document.getElementById('timelineDiv1').style.display !== "none" && - document.getElementById('timelineDiv2').style.display !== "none", "Both timelines are not visible" ); + ok (document.getElementById( 'timelineDiv1' ).style.display !== "none" && + document.getElementById( 'timelineDiv2' ).style.display !== "none", "Both timelines are not visible" ); plus(); popped.pause().removeTrackEvent( setupId ); - ok( !document.getElementById('timeline').children[0], "removed timeline was properly destroyed" ); + ok( !document.getElementById( 'timeline' ).children[ 0 ], "removed timeline was properly destroyed" ); plus(); }); -- 2.43.0