зеркало из https://github.com/mozilla/popcorn-js.git
[#374] removing setinterval from plugin tests, had problems with wiki, so not included yet
This commit is contained in:
Родитель
a57895b2a2
Коммит
080c03ac7f
|
@ -3,8 +3,6 @@ test("Popcorn Flickr Plugin", function () {
|
|||
var popped = Popcorn("#video"),
|
||||
expects = 5,
|
||||
count = 0,
|
||||
interval,
|
||||
interval2,
|
||||
flickrdiv = document.getElementById('flickrdiv');
|
||||
|
||||
expect( expects );
|
||||
|
@ -31,23 +29,17 @@ test("Popcorn Flickr Plugin", function () {
|
|||
target: 'flickrdiv'
|
||||
} );
|
||||
|
||||
interval = setInterval( function() {
|
||||
if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
|
||||
popped.exec( 2, function() {
|
||||
ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
|
||||
plus();
|
||||
ok( /img/.test( flickrdiv.innerHTML ), "An image exists" );
|
||||
plus();
|
||||
clearInterval( interval );
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
|
||||
interval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 3 ) {
|
||||
popped.exec( 4, function() {
|
||||
ok( /display: none;/.test( flickrdiv.innerHTML ), "Div contents are hidden again" );
|
||||
plus();
|
||||
clearInterval( interval2 );
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
popped.volume(0);
|
||||
popped.play();
|
||||
|
||||
|
|
|
@ -3,9 +3,6 @@ test("Popcorn Footnote Plugin", function () {
|
|||
var popped = Popcorn("#video"),
|
||||
expects = 7,
|
||||
count = 0,
|
||||
interval,
|
||||
interval2,
|
||||
interval3,
|
||||
footnotediv = document.getElementById('footnotediv');
|
||||
|
||||
expect(expects);
|
||||
|
@ -26,46 +23,36 @@ test("Popcorn Footnote Plugin", function () {
|
|||
|
||||
popped.footnote({
|
||||
start: 0, // seconds
|
||||
end: 5, // seconds
|
||||
end: 2, // seconds
|
||||
text: 'This video made exclusively for drumbeat.org',
|
||||
target: 'footnotediv'
|
||||
} )
|
||||
.footnote({
|
||||
start: 7, // seconds
|
||||
end: 14, // seconds
|
||||
start: 2, // seconds
|
||||
end: 4, // seconds
|
||||
text: 'Visit webmademovies.org for more details',
|
||||
target: 'footnotediv'
|
||||
} )
|
||||
.volume(0)
|
||||
.play();
|
||||
.volume(0);
|
||||
|
||||
|
||||
interval = setInterval( function() {
|
||||
if( popped.currentTime() > 0 && popped.currentTime() <= 5 ) {
|
||||
popped.exec( 1, function() {
|
||||
equals ( footnotediv.childElementCount, 2, "footnotediv now has two inner elements" );
|
||||
plus();
|
||||
equals (footnotediv.children[0].innerHTML , "This video made exclusively for drumbeat.org", "footnote displaing correct information" );
|
||||
plus();
|
||||
equals (footnotediv.children[0].style.display , "inline", "footnote is visible on the page" );
|
||||
plus();
|
||||
clearInterval( interval );
|
||||
}
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
interval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 7 && popped.currentTime() < 14 ) {
|
||||
popped.exec( 3, function() {
|
||||
equals (footnotediv.children[1].style.display , "inline", "second footnote is visible on the page" );
|
||||
plus();
|
||||
clearInterval( interval2 );
|
||||
}
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
interval3 = setInterval( function() {
|
||||
if( popped.currentTime() > 14) {
|
||||
popped.exec( 5, function() {
|
||||
ok (footnotediv.children[1].style.display === 'none' && footnotediv.children[0].style.display === 'none', "footnote are no longer vidible on the page" );
|
||||
plus();
|
||||
clearInterval( interval3 );
|
||||
}
|
||||
}, 15000);
|
||||
});
|
||||
popped.play();
|
||||
|
||||
});
|
||||
|
|
|
@ -2,11 +2,7 @@ test("Popcorn Google Map Plugin", function () {
|
|||
|
||||
var popped = Popcorn("#video"),
|
||||
expects = 10,
|
||||
count = 0,
|
||||
mapInterval,
|
||||
mapInterval2,
|
||||
mapInterval3,
|
||||
mapInterval4;
|
||||
count = 0;
|
||||
|
||||
expect(expects);
|
||||
|
||||
|
@ -44,12 +40,9 @@ test("Popcorn Google Map Plugin", function () {
|
|||
location:'boston',
|
||||
zoom: 15
|
||||
} )
|
||||
.volume(0)
|
||||
.play();
|
||||
.volume(0);
|
||||
|
||||
|
||||
mapInterval = setInterval( function() {
|
||||
if( popped.currentTime() > 3 && popped.currentTime() <= 5 ) {
|
||||
popped.exec( 4, function() {
|
||||
ok(google.maps, "Google maps is available");
|
||||
plus();
|
||||
ok(google.maps.Geocoder, "Google maps Geocoder is available");
|
||||
|
@ -58,25 +51,21 @@ test("Popcorn Google Map Plugin", function () {
|
|||
plus();
|
||||
equals (document.getElementById('actualmap1').offsetParent.id, "map", "First map is inside the 'map' div" );
|
||||
plus();
|
||||
clearInterval( mapInterval );
|
||||
}
|
||||
}, 1000);
|
||||
mapInterval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 3 && popped.currentTime() <= 5 ) {
|
||||
});
|
||||
|
||||
popped.exec( 4, function() {
|
||||
ok (document.getElementById('actualmap2'), "Second map is on the page" );
|
||||
plus();
|
||||
equals (document.getElementById('actualmap2').offsetParent.id, "map2", "Second map is inside the 'map2' div" );
|
||||
plus();
|
||||
clearInterval( mapInterval2 );
|
||||
}
|
||||
}, 1000);
|
||||
mapInterval3 = setInterval( function() {
|
||||
if( popped.currentTime() > 5 ) {
|
||||
});
|
||||
|
||||
popped.exec( 6, function() {
|
||||
ok (document.getElementById('actualmap2').style.display === "none" &&
|
||||
document.getElementById('actualmap1').style.display === "none", "Both maps are no lnger visible" );
|
||||
plus();
|
||||
clearInterval( mapInterval3 );
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
popped.play();
|
||||
|
||||
});
|
||||
|
|
|
@ -3,8 +3,6 @@ test("Popcorn Image Plugin", function () {
|
|||
var popped = Popcorn("#video"),
|
||||
expects = 5,
|
||||
count = 0,
|
||||
interval,
|
||||
interval2,
|
||||
imagediv = document.getElementById('imagediv');
|
||||
|
||||
expect( expects );
|
||||
|
@ -31,24 +29,17 @@ test("Popcorn Image Plugin", function () {
|
|||
target: 'imagediv'
|
||||
} );
|
||||
|
||||
interval = setInterval( function() {
|
||||
if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
|
||||
popped.exec( 2, function() {
|
||||
ok( /display: inline;/.test( imagediv.innerHTML ), "Div contents are displayed" );
|
||||
plus();
|
||||
ok( /img/.test( imagediv.innerHTML ), "An image exists" );
|
||||
plus();
|
||||
clearInterval( interval );
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
|
||||
interval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 3 ) {
|
||||
popped.exec( 4, function() {
|
||||
ok( /display: none;/.test( imagediv.innerHTML ), "Div contents are hidden again" );
|
||||
plus();
|
||||
clearInterval( interval2 );
|
||||
}
|
||||
}, 500);
|
||||
popped.volume(0);
|
||||
popped.play();
|
||||
});
|
||||
popped.volume(0).play();
|
||||
|
||||
});
|
||||
|
|
|
@ -8,9 +8,6 @@ test("Popcorn LastFM Plugin", function () {
|
|||
var popped = Popcorn("#video"),
|
||||
expects = 8,
|
||||
count = 0,
|
||||
interval,
|
||||
interval2,
|
||||
interval3,
|
||||
lastfmdiv = document.getElementById('lastfmdiv');
|
||||
|
||||
expect( expects );
|
||||
|
@ -35,53 +32,42 @@ test("Popcorn LastFM Plugin", function () {
|
|||
artist: 'yacht',
|
||||
target: 'lastfmdiv',
|
||||
apikey: '30ac38340e8be75f9268727cb4526b3d'
|
||||
} )
|
||||
})
|
||||
.lastfm({
|
||||
start: 2.5, // seconds
|
||||
start: 2, // seconds
|
||||
end: 7, // seconds
|
||||
artist: 'the beatles',
|
||||
target: 'lastfmdiv',
|
||||
apikey: '30ac38340e8be75f9268727cb4526b3d'
|
||||
} )
|
||||
})
|
||||
.lastfm({
|
||||
start: 4.5, // seconds
|
||||
start: 4, // seconds
|
||||
end: 7, // seconds
|
||||
artist: '',
|
||||
target: 'lastfmdiv',
|
||||
apikey: '30ac38340e8be75f9268727cb4526b3d'
|
||||
} );
|
||||
|
||||
interval = setInterval( function() {
|
||||
if( popped.currentTime() > 1 && popped.currentTime() < 4 ) {
|
||||
});
|
||||
|
||||
popped.exec( 2, function() {
|
||||
equals ( lastfmdiv.childElementCount, 3, "lastfmdiv now has three inner elements" );
|
||||
plus();
|
||||
equals (lastfmdiv.children[0].style.display , "inline", "yachtdiv is visible on the page" );
|
||||
plus();
|
||||
clearInterval( interval );
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
interval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 2.5 && popped.currentTime() < 3 ) {
|
||||
equals (lastfmdiv.children[0].style.display , "inline", "yachtdiv is visible on the page" );
|
||||
popped.exec( 3, function() {
|
||||
equals (lastfmdiv.children[0].style.display , "inline", "yachtdiv is still visible on the page" );
|
||||
plus();
|
||||
equals (lastfmdiv.children[1].style.display , "inline", "beatlesdiv is visible on the page" );
|
||||
plus();
|
||||
equals (lastfmdiv.children[2].style.display , "none", "nulldiv is not visible on the page" );
|
||||
plus();
|
||||
clearInterval( interval2 );
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
interval3 = setInterval( function() {
|
||||
if( popped.currentTime() > 4.5 && popped.currentTime() < 7 ) {
|
||||
popped.exec( 5, function() {
|
||||
equals (lastfmdiv.children[2].innerHTML , "Unknown Artist", "Artist information could not be found" );
|
||||
plus();
|
||||
clearInterval( interval3 );
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
popped.volume(0);
|
||||
popped.play();
|
||||
popped.volume(0).play();
|
||||
});
|
||||
|
|
|
@ -3,9 +3,6 @@ test("Popcorn tagthisperson Plugin", function () {
|
|||
var popped = Popcorn( "#video" ),
|
||||
expects = 8,
|
||||
count = 0,
|
||||
interval,
|
||||
interval2,
|
||||
interval3,
|
||||
tagdiv = document.getElementById( 'tagdiv' );
|
||||
tagdiv2 = document.getElementById( 'tagdiv2' );
|
||||
|
||||
|
@ -19,71 +16,62 @@ test("Popcorn tagthisperson Plugin", function () {
|
|||
|
||||
stop();
|
||||
|
||||
ok ( 'tagthisperson' in popped, "tagthisperson is a method of the popped instance" );
|
||||
ok( 'tagthisperson' in popped, "tagthisperson is a method of the popped instance" );
|
||||
plus();
|
||||
|
||||
equals ( tagdiv.innerHTML, "", "initially, there is nothing inside the tagdiv" );
|
||||
equals( tagdiv.innerHTML, "", "initially, there is nothing inside the tagdiv" );
|
||||
plus();
|
||||
|
||||
popped.tagthisperson({
|
||||
start: 0, // seconds
|
||||
end: 5, // seconds
|
||||
end: 1, // seconds
|
||||
person: 'Anna Sob',
|
||||
image: 'http://newshour.s3.amazonaws.com/photos%2Fspeeches%2Fguests%2FRichardNSmith_thumbnail.jpg',
|
||||
href: 'http://annasob.wordpress.com',
|
||||
target: 'tagdiv'
|
||||
} )
|
||||
})
|
||||
.tagthisperson({
|
||||
start: 3, // seconds
|
||||
end: 10, // seconds
|
||||
start: 1, // seconds
|
||||
end: 2, // seconds
|
||||
person: 'Scott',
|
||||
href: 'http://scottdowne.wordpress.com/',
|
||||
target: 'tagdiv'
|
||||
} )
|
||||
})
|
||||
.tagthisperson({
|
||||
start: 6, // seconds
|
||||
end: 10, // seconds
|
||||
start: 1, // seconds
|
||||
end: 2, // seconds
|
||||
person: 'Mike',
|
||||
target: 'tagdiv2'
|
||||
} )
|
||||
})
|
||||
.tagthisperson({
|
||||
start: 7, // seconds
|
||||
end: 12, // seconds
|
||||
start: 1, // seconds
|
||||
end: 2, // seconds
|
||||
person: 'Daniel',
|
||||
target: 'tagdiv2'
|
||||
} )
|
||||
.volume(0)
|
||||
.play();
|
||||
})
|
||||
.volume(0);
|
||||
|
||||
popped.exec( 0, function() {
|
||||
equals( tagdiv.childElementCount, 2, "tagdiv now contains two child elements" );
|
||||
plus();
|
||||
equals( tagdiv.textContent.trim() , "Anna Sob" ,"tagdiv shows the first tag" );
|
||||
plus();
|
||||
});
|
||||
|
||||
interval = setInterval( function() {
|
||||
if( popped.currentTime() > 0 && popped.currentTime() <= 5 ) {
|
||||
equals ( tagdiv.childElementCount, 2, "tagdiv now contains two child elements" );
|
||||
popped.exec( 1, function() {
|
||||
equals( tagdiv.innerHTML.search( "<a href" ) , 1 ,"second tag in tagdiv has a url" );
|
||||
plus();
|
||||
equals ( tagdiv.textContent.trim() , "Anna Sob" ,"tagdiv shows the first tag" );
|
||||
equals( tagdiv2.textContent.trim(), "Mike, Daniel" ,"tagdiv2 shows the first & second tag" );
|
||||
plus();
|
||||
clearInterval( interval );
|
||||
}
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
interval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 5 ) {
|
||||
equals ( tagdiv.innerHTML.search( "<a href" ) , 1 ,"second tag in tagdiv has a url" );
|
||||
popped.exec( 2, function() {
|
||||
equals( tagdiv.innerHTML , "" ,"tagdiv is now cleared" );
|
||||
plus();
|
||||
equals ( tagdiv2.textContent.trim(), "Mike, Daniel" ,"tagdiv2 shows the first & second tag" );
|
||||
equals( tagdiv2.innerHTML , "" ,"tagdiv2 is now cleared" );
|
||||
plus();
|
||||
clearInterval( interval2 );
|
||||
}
|
||||
}, 4000);
|
||||
});
|
||||
|
||||
interval3 = setInterval( function() {
|
||||
if( popped.currentTime() > 12 ) {
|
||||
equals ( tagdiv.innerHTML , "" ,"tagdiv is now cleared" );
|
||||
plus();
|
||||
equals ( tagdiv2.innerHTML , "" ,"tagdiv2 is now cleared" );
|
||||
plus();
|
||||
clearInterval( interval3 );
|
||||
}
|
||||
}, 4000);
|
||||
popped.play();
|
||||
|
||||
});
|
||||
|
|
|
@ -3,8 +3,6 @@ test("Popcorn Twitter Plugin", function () {
|
|||
var popped = Popcorn("#video"),
|
||||
expects = 6,
|
||||
count = 0,
|
||||
interval,
|
||||
interval2,
|
||||
twitterdiv = document.getElementById('twitterdiv');
|
||||
|
||||
expect( expects );
|
||||
|
@ -32,29 +30,23 @@ test("Popcorn Twitter Plugin", function () {
|
|||
|
||||
popped.twitter({
|
||||
start: 1, // seconds
|
||||
end: 3, // seconds
|
||||
end: 2, // seconds
|
||||
title: 'Steve Song',
|
||||
src: '@stevesong',
|
||||
target: 'twitterdiv',
|
||||
} );
|
||||
|
||||
interval = setInterval( function() {
|
||||
if( popped.currentTime() > 1 && popped.currentTime() < 3 ) {
|
||||
popped.exec( 1, function() {
|
||||
ok( /display: inline;/.test( twitterdiv.innerHTML ), "Div contents are displayed" );
|
||||
plus();
|
||||
ok( /twtr-widget/.test( twitterdiv.innerHTML ), "A Twitter widget exists" );
|
||||
plus();
|
||||
clearInterval( interval );
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
|
||||
interval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 3 ) {
|
||||
popped.exec( 2, function() {
|
||||
ok( /display: none;/.test( twitterdiv.innerHTML ), "Div contents are hidden again" );
|
||||
plus();
|
||||
clearInterval( interval2 );
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
|
||||
popped.play();
|
||||
|
||||
|
|
|
@ -3,11 +3,8 @@ test("Popcorn Webpage Plugin", function () {
|
|||
var popped = Popcorn("#video"),
|
||||
expects = 10,
|
||||
count = 0,
|
||||
iframeInterval,
|
||||
iframeInterval2,
|
||||
iframeInterval3,
|
||||
iframeInterval4;
|
||||
theiFrame = document.getElementsByTagName('iframe');
|
||||
|
||||
expect(expects);
|
||||
|
||||
function plus() {
|
||||
|
@ -27,23 +24,20 @@ test("Popcorn Webpage Plugin", function () {
|
|||
popped.webpage({
|
||||
id: "webpages-a",
|
||||
start: 0, // seconds
|
||||
end: 5, // seconds
|
||||
end: 1, // seconds
|
||||
src: 'http://webmademovies.org',
|
||||
target: 'webpagediv'
|
||||
})
|
||||
.webpage({
|
||||
id: "webpages-b",
|
||||
start: 7, // seconds
|
||||
end: 10, // seconds
|
||||
start: 1, // seconds
|
||||
end: 2, // seconds
|
||||
src: 'http://zenit.senecac.on.ca/wiki/index.php/Processing.js',
|
||||
target: 'webpagediv'
|
||||
})
|
||||
.volume(0)
|
||||
.play();
|
||||
.volume(0);
|
||||
|
||||
|
||||
iframeInterval = setInterval( function() {
|
||||
if( popped.currentTime() > 1 && popped.currentTime() <= 5 ) {
|
||||
popped.exec( 0, function() {
|
||||
ok (!!theiFrame[0], "iframe was created" );
|
||||
plus();
|
||||
equals (theiFrame.length, 2, "there is only two iframes on the page" );
|
||||
|
@ -52,28 +46,22 @@ test("Popcorn Webpage Plugin", function () {
|
|||
plus();
|
||||
equals (theiFrame[0].src, "http://webmademovies.org/", "iframe has the src 'http://webmademovies.org/'" );
|
||||
plus();
|
||||
clearInterval( iframeInterval );
|
||||
}
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
iframeInterval2 = setInterval( function() {
|
||||
if( popped.currentTime() > 10 ) {
|
||||
popped.exec( 2, function() {
|
||||
ok (theiFrame[0].style.display === 'none' && theiFrame[1].style.display === 'none', "both iframes are hidden" );
|
||||
plus();
|
||||
clearInterval( iframeInterval2 );
|
||||
}
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
iframeInterval3 = setInterval( function() {
|
||||
if( popped.currentTime() > 8 && popped.currentTime() <= 10 ) {
|
||||
popped.exec( 1, function() {
|
||||
ok (!!theiFrame[1], "iframe was created" );
|
||||
plus();
|
||||
equals (theiFrame[1].id, "webpages-b", "iframe second has the id 'webpages-b'" );
|
||||
plus();
|
||||
equals (theiFrame[1].src,"http://zenit.senecac.on.ca/wiki/index.php/Processing.js", "iframe has the src 'http://zenit.senecac.on.ca/wiki/index.php/Processing.js'" );
|
||||
plus();
|
||||
clearInterval( iframeInterval3 );
|
||||
}
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
popped.play();
|
||||
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче