]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#166] unit tests for flickr plugin
authorScottDowne <sdowne@learn.senecac.on.ca>
Tue, 21 Dec 2010 17:36:31 +0000 (12:36 -0500)
committerScottDowne <sdowne@learn.senecac.on.ca>
Tue, 21 Dec 2010 17:36:31 +0000 (12:36 -0500)
plugins/flickr/popcorn.flickr.js
plugins/flickr/popcorn.flickr.unit.js

index 748dbcf92c54aece52265679297bd03d8f4001e6..e620f1a9de16a83d796ba0f5ce957eefe795865f 100644 (file)
@@ -74,6 +74,7 @@
               image.setAttribute( 'width', width );
               image.setAttribute( 'style', 'border:' + border + ';padding:' + padding );
               link.appendChild( image );
+              
               options.container.appendChild( link );
             } else {
               return false;
index 97ec0343c95a99a62ec00327b6cb9bae0af2859c..3157bf6ae2266228c1f0c946158cabc8d8976fe2 100644 (file)
@@ -1,19 +1,16 @@
 test("Popcorn Flickr Plugin", function () {
   
   var popped = Popcorn("#video"),
-      expects = 6, 
+      expects = 5, 
       count = 0,
       interval,
       interval2,
-      interval3,
       flickrdiv = document.getElementById('flickrdiv');
-
-  var images = document.getElementsByTagName('img');
   
-  expect(expects);
+  expect( expects );
   
   function plus() {
-    if ( ++count===expects) {
+    if ( ++count === expects) {
       start();
     }
   }
@@ -27,42 +24,31 @@ test("Popcorn Flickr Plugin", function () {
   plus();
   
   popped.flickr({
-    start: 5, // seconds
-    end: 15, // seconds
+    start: 1, // seconds
+    end: 3, // seconds
     userid: '35034346917@N01',
     numberofimages: '1',
     target: 'flickrdiv'
   } );
 
-  console.log(images);
-
-  /*interval = setInterval( function() {
-    if( popped.currentTime() > 5 && popped.currentTime() <= 15 ) {
-      console.log(images[0].style);
-      ok( images[0].style.display === "inline" && images[1].style.display === "none", "first image is displayed, second is not" );
+  interval = setInterval( function() {
+    if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
+      ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
+      plus();
+      ok( /img/.test( flickrdiv.innerHTML ), "An image exists" );
       plus();
       clearInterval( interval );
     }
-  }, 5000);
+  }, 500);
   
   interval2 = setInterval( function() {
-    if( popped.currentTime() > 15 && popped.currentTime() < 35  ) {
-      console.log(images);
-      ok( images[0].style.display === "none" && images[1].style.display === "none", "neither image is displayed" );
+    if( popped.currentTime() > 3 ) {
+      ok( /display: none;/.test( flickrdiv.innerHTML ), "Div contents are hidden again" );
       plus();
       clearInterval( interval2 );
     }
-  }, 5000);
+  }, 500);
   
-  interval3 = setInterval( function() {
-    if( popped.currentTime() > 35 && popped.currentTime() < 45 ) {
-      console.log(images);
-      ok( images[0].style.display === "none" && images[1].style.display === "inline", "second image is displayed, first is not" );
-      plus();
-      clearInterval( interval3 );
-    }
-  }, 5000);*/
-
   popped.play();
   
 });