From 803386daf9f922a3fe8bbb4afc00842b575e5687 Mon Sep 17 00:00:00 2001 From: ScottDowne Date: Tue, 21 Dec 2010 12:36:31 -0500 Subject: [PATCH] [#166] unit tests for flickr plugin --- plugins/flickr/popcorn.flickr.js | 1 + plugins/flickr/popcorn.flickr.unit.js | 42 +++++++++------------------ 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/plugins/flickr/popcorn.flickr.js b/plugins/flickr/popcorn.flickr.js index 748dbcf..e620f1a 100644 --- a/plugins/flickr/popcorn.flickr.js +++ b/plugins/flickr/popcorn.flickr.js @@ -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; diff --git a/plugins/flickr/popcorn.flickr.unit.js b/plugins/flickr/popcorn.flickr.unit.js index 97ec034..3157bf6 100644 --- a/plugins/flickr/popcorn.flickr.unit.js +++ b/plugins/flickr/popcorn.flickr.unit.js @@ -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(); }); -- 2.43.0