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 ) {
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({
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();
});