#485 Added unit tests to make sure the order of the images created appear in the same order

This commit is contained in:
Mohammed Buttu 2011-05-17 15:53:06 -04:00
Родитель 8fa0f530f9
Коммит db5892c769
1 изменённых файлов: 41 добавлений и 10 удалений

Просмотреть файл

@ -1,9 +1,14 @@
test("Popcorn Image Plugin", function () {
var popped = Popcorn( "#video" ),
expects = 5,
expects = 8,
count = 0,
imagediv = document.getElementById( "imagediv" );
imagediv = document.getElementById( "imagediv" ),
sources = [
"https://www.drumbeat.org/media//images/drumbeat-logo-splash.png",
"http://www.petmountain.com/category/mini/organic-dog-supplies/520/organic-dog-supplies.jpg",
"http://www.botskool.com/sites/default/files/images/javascript.png"
];
expect( expects );
@ -27,9 +32,27 @@ test("Popcorn Image Plugin", function () {
// seconds
end: 3,
href: "http://www.drumbeat.org/",
src: "https://www.drumbeat.org/media//images/drumbeat-logo-splash.png",
src: sources[0],
text: "DRUMBEAT",
target: "imagediv"
})
.image({
// seconds
start: 4,
// seconds
end: 6,
// no href
src: sources[1],
target: "imagediv"
})
.image({
// seconds
start: 4,
// seconds
end: 6,
// no href
src: sources[2],
target: "imagediv"
});
popped.exec( 2, function() {
@ -44,5 +67,13 @@ test("Popcorn Image Plugin", function () {
plus();
});
popped.exec( 5, function() {
[].forEach.call( document.querySelectorAll( "#imagediv a img" ), function( img, idx ) {
alert(idx);
ok( img.src === sources[ idx ], "Image " + idx + " is in the right order" );
plus();
});
});
popped.volume( 0 ).play();
});