]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#384] Fixed linting error and options.diretion not being defined issue, unit tests...
authorDavid Seifried <david.c.seifried@gmail.com>
Tue, 21 Jun 2011 18:40:21 +0000 (14:40 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Tue, 21 Jun 2011 18:40:21 +0000 (14:40 -0400)
plugins/timeline/popcorn.timeline.js
plugins/timeline/popcorn.timeline.unit.js

index b9d6f67954a66aef99c5ae0dc85a40e1b9c1bbed..4d5620402b0f70ac071f584a4d119185e5e6fa3e 100644 (file)
     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 ) {
 
index 852ba7859c6ea73bbf1c114dc35355578512c9af..cd680d52328f09fc3fbb250da65a4b4fe20ee8ba 100644 (file)
@@ -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();
   });