From: Minoo Date: Sat, 16 Apr 2011 00:03:59 +0000 (-0400) Subject: fixed image plugin lint errors, unit test, added optional text -#368 X-Git-Tag: v0.5~15^2~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=b2ffd66fe96d784cd515a2c9ac757fa9fccd922c;p=popcorn-js.git fixed image plugin lint errors, unit test, added optional text -#368 --- diff --git a/plugins/image/popcorn.image.js b/plugins/image/popcorn.image.js index c6b03d5..734ac93 100644 --- a/plugins/image/popcorn.image.js +++ b/plugins/image/popcorn.image.js @@ -8,10 +8,11 @@ * Options parameter will need a start, end, href, target and src. * Start is the time that you want this plug-in to execute * End is the time that you want this plug-in to stop executing - * href is the url of the destination of a link + * href is the url of the destination of a link - optional * Target is the id of the document element that the iframe needs to be attached to, * this target element must exist on the DOM * Src is the url of the image that you want to display + * text is the overlayed text on the image - optional * * @param {Object} options * @@ -47,6 +48,7 @@ }, _setup: function( options ) { + var st; options.link = document.createElement( 'a' ); options.link.style.position = "relative"; @@ -74,7 +76,7 @@ fontSize: fontHeight, color: "black", fontWeight : "bold", - zIndex: "10", + zIndex: "10" }; for ( st in divTextStyle ) { divText.style[ st ] = divTextStyle[ st ]; diff --git a/plugins/image/popcorn.image.unit.js b/plugins/image/popcorn.image.unit.js index 79b96bc..d556067 100644 --- a/plugins/image/popcorn.image.unit.js +++ b/plugins/image/popcorn.image.unit.js @@ -32,24 +32,22 @@ test("Popcorn Image Plugin", function () { target: 'imagediv' } ); - interval = setInterval( function() { + popped.exec( 2, function() { if( popped.currentTime() > 1 && popped.currentTime() < 3 ) { ok( /display: block;/.test( imagediv.innerHTML ), "Div contents are displayed" ); plus(); ok( /img/.test( imagediv.innerHTML ), "An image exists" ); plus(); - clearInterval( interval ); } - }, 500); + }); - interval2 = setInterval( function() { + popped.exec( 4, function() { if( popped.currentTime() > 3 ) { ok( /display: none;/.test( imagediv.innerHTML ), "Div contents are hidden again" ); plus(); - clearInterval( interval2 ); } - }, 500); - popped.volume(0); - popped.play(); + }); + popped.volume(0); + popped.play(); });