From: Minoo Date: Thu, 10 Mar 2011 01:17:36 +0000 (-0500) Subject: updated the image plugin, fixed some lint complaints, modified the test for text... X-Git-Tag: v0.5~15^2~11 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=5d50d383147463bad49d3eff9794f5525a40149d;p=popcorn-js.git updated the image plugin, fixed some lint complaints, modified the test for text overlaying -#368 --- diff --git a/plugins/image/popcorn.image.js b/plugins/image/popcorn.image.js index 9fe50a9..a9065c6 100644 --- a/plugins/image/popcorn.image.js +++ b/plugins/image/popcorn.image.js @@ -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 @@ -78,13 +79,13 @@ 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 ); }, diff --git a/plugins/image/popcorn.image.unit.js b/plugins/image/popcorn.image.unit.js index 00b1325..9281b03 100644 --- a/plugins/image/popcorn.image.unit.js +++ b/plugins/image/popcorn.image.unit.js @@ -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 ); }