]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
updated the image plugin, fixed some lint complaints, modified the test for text...
authorMinoo <minoo.ziaei@gmail.com>
Thu, 10 Mar 2011 01:17:36 +0000 (20:17 -0500)
committerMinoo <minoo.ziaei@gmail.com>
Thu, 10 Mar 2011 01:17:36 +0000 (20:17 -0500)
plugins/image/popcorn.image.js
plugins/image/popcorn.image.unit.js

index 9fe50a951e546d098d9bdcb05a27da89e2b32a76..a9065c68dae4ded9ec72c50855cb40bc14dbde59 100644 (file)
@@ -47,7 +47,8 @@
       },
 
       _setup: function( options ) {
-
+        var s, st; 
+        
         options.link = document.createElement( 'a' );
         options.link.style.display = "none"; // display none by default
         if ( options.href ) {
@@ -65,9 +66,9 @@
           backgroundSize : '100%',
           MozBackgroundSize: '100%',
           borderStyle : 'none'
-        }
-        for (s in divStyle) {
-          div.style[s] = divStyle[s];
+        };
+        for ( s in divStyle ) {
+          div.style[ s ] = divStyle[ s ];
         }
         
         var divText = document.createElement( 'div' ); // add the inner div for overlaying text
           color : 'black',
           fontWeight : 'bold',
           textAlign : 'center'
+        };
+        for ( st in divTextStyle ) {
+          divText.style[ st ] = divTextStyle[ st ];
         }
-        for (st in divTextStyle) {
-          divText.style[st] = divTextStyle[st];
-        }
-        divText.innerHTML = options.text
+        divText.innerHTML = options.text;
         
-        div.appendChild( divText); 
+        div.appendChild( divText ); 
         options.link.appendChild( div );
         
       },
index 00b1325662fdbd061ce8f9de7706935944a41098..9281b03be4a34765b4e6b8cb07424110c93d5c6a 100644 (file)
@@ -28,6 +28,7 @@ test("Popcorn Image Plugin", function () {
     end: 3, // seconds
     href: 'http://www.drumbeat.org/',
     src: 'https://www.drumbeat.org/media//images/drumbeat-logo-splash.png',
+    text: 'DRUMBEAT',
     target: 'imagediv'
   } );
 
@@ -35,7 +36,7 @@ test("Popcorn Image Plugin", function () {
     if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
       ok( /display: inline;/.test( imagediv.innerHTML ), "Div contents are displayed" );
       plus();
-      ok( /img/.test( imagediv.innerHTML ), "An image exists" );
+      equals (imagediv.children[0].children[0].style.backgroundImage.indexOf ( 'https' ), "4", "An image exists" );
       plus();
       clearInterval( interval );
     }