]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#556] Added some styling changes, rearranged some stuff, and wrote a unit test
authorDavid Seifried <david.c.seifried@gmail.com>
Wed, 22 Jun 2011 14:25:11 +0000 (10:25 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Wed, 22 Jun 2011 14:25:11 +0000 (10:25 -0400)
plugins/googlefeed/popcorn.googlefeed.js
plugins/googlefeed/popcorn.googlefeed.unit.js

index 7b4417b82d120ba4273341230544e7a673405109..d2ce8b8e964196588d70b775fd8c755ee33d5019 100755 (executable)
@@ -24,7 +24,7 @@
 
     //  Checking if the css file is already included
     for ( ; k < len; k++ ){
-      if ( links[ k ].href == "http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css" ) {
+      if ( links[ k ].href === "http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css" ) {
         dontLoad = true;
       }
     }
       }
     };
 
+    // Default to vertical orientation if empty or incorrect input
+    if( !options.orientation || ( options.orientation.toLowerCase() !== "vertical" &&
+      options.orientation.toLowerCase() !== "horizontal" ) ) {
+      options.orientation = "vertical";
+    }
+
     newdiv.style.display = "none";
     newdiv.id = "_feed" + i;
     newdiv.style.width = "100%";
        */
       start: function( event, options ){
         newdiv.setAttribute( "style", "display:inline" );
-        // Default to vertical orientation if empty or incorrect input
-        if( !options.orientation || ( options.orientation.toLowerCase() !== "vertical" &&
-          options.orientation.toLowerCase() !== "horizontal" ) ) {
-          options.orientation = "vertical";
-        }
       },
       /**
        * @member webpage
     },
     options: {
       start: {
-        elem:"input", 
-        type:"text", 
-        label:"In" 
+        elem: "input", 
+        type: "text", 
+        label: "In" 
       },
       end: { 
-        elem:"input", 
-        type:"text", 
-        label:"Out" 
+        elem: "input", 
+        type: "text", 
+        label: "Out" 
       },
       target: "feed-container",
       url: { 
-        elem:"input", 
-        type:"text", 
-        label:"url" 
+        elem: "input", 
+        type: "text", 
+        label: "url" 
       },
       title: { 
-        elem:"input", 
-        type:"text", 
-        label:"title" 
+        elem: "input", 
+        type: "text", 
+        label: "title" 
       },
       orientation: {
-        elem:"select", 
-        options:["Vertical","Horizontal"], 
-        label:"orientation" 
+        elem: "select", 
+        options: [ "Vertical","Horizontal" ], 
+        label: "orientation" 
       }
     }
   });
index 7fcada9178e5ad1bbc8060775bffe2ee33381095..027625b4c05fc031a4d35d285a369d1f2e299637 100755 (executable)
@@ -1,21 +1,21 @@
 test("Popcorn Google Feed Plugin", function () {
   
-  var popped = Popcorn("#video"),
-      expects = 11,
+  var popped = Popcorn( "#video" ),
+      expects = 12,
       setupId, 
       count = 0;
   
   expect(expects);
   
   function plus() {
-    if ( ++count===expects) {
+    if ( ++count === expects) {
       start();
     }
   }
   
   stop();
 
-    ok ('googlefeed' in popped, "googlefeed is a method of the popped instance");
+    ok ( 'googlefeed' in popped, "googlefeed is a method of the popped instance" );
     plus();
     ok ( document.getElementById('feed').innerHTML === "", "initially, there is nothing inside the feed" );
     plus();
@@ -28,7 +28,6 @@ test("Popcorn Google Feed Plugin", function () {
     target: "feed",
     url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml",
     title: "Planet Feed",
-    orientation: "Vertical"
        })
        .googlefeed({
     start: 2, // seconds
@@ -43,23 +42,25 @@ test("Popcorn Google Feed Plugin", function () {
   setupId = popped.getLastTrackEventId();
   
   popped.exec( 1, function() {
-    ok(google.load, "Google Feed is available");
+    ok( google.load, "Google Feed is available");
     plus();
-    ok(GFdynamicFeedControl, "Dynamic Feed Control Available");
+    ok( GFdynamicFeedControl, "Dynamic Feed Control Available");
     plus();
-    ok (document.getElementById('_feed1'), "First feed is on the page" );
+    ok ( document.getElementById('_feed1'), "First feed is on the page" );
     plus();
-    equals (document.getElementById('_feed1').offsetParent.id, "feed", "First feed is inside the 'feed' div" );
+    equals ( document.getElementById('_feed1').offsetParent.id, "feed", "First feed is inside the 'feed' div" );
+    plus();
+    equals( popped.data.trackEvents.byStart[1].orientation, "vertical", "Defaulting to vertical orientation" );
     plus();
   });
   popped.exec( 2, function() {
-    ok (document.getElementById('_feed2'), "Second feed is on the page" );
+    ok ( document.getElementById('_feed2'), "Second feed is on the page" );
     plus();
-    equals (document.getElementById('_feed2').offsetParent.id, "feed1", "Second feed is inside the 'feed2' div" );
+    equals ( document.getElementById('_feed2').offsetParent.id, "feed1", "Second feed is inside the 'feed2' div" );
     plus();
   });
   popped.exec( 3, function() {
-    ok (document.getElementById('_feed2').style.display === "none" && 
+    ok ( document.getElementById('_feed2').style.display === "none" && 
         document.getElementById('_feed1').style.display === "none", "Both feeds are no lnger visible" );
          plus();