[#1158] Added youtube player tests for ticket 1155

This commit is contained in:
Matthew Schranz 2012-06-20 11:36:28 -04:00
Родитель f87c5153f7
Коммит c74f408e8b
2 изменённых файлов: 10 добавлений и 3 удалений

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

@ -52,5 +52,6 @@
<div id="video14" style="width: 360px; height: 300px" ></div>
<div id="video15" style="width: 360px; height: 300px" ></div>
<div id="video16" style="width: 360px; height: 300px" ></div>
<div id="customHeight" style="width: 800px; height: 450px" ></div>
</body>
</html>

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

@ -440,13 +440,14 @@ asyncTest( "Popcorn YouTube Plugin Url Regex Test", function() {
asyncTest( "Player height and width", function() {
expect( 4 );
expect( 6 );
var popcorn1 = Popcorn.youtube( "#video4", "http://www.youtube.com/watch?v=nfGV32RNkhw" ),
popcorn2 = Popcorn.youtube( "#video5", "http://www.youtube.com/watch?v=nfGV32RNkhw" ),
popcorn3 = Popcorn.youtube( "#customHeight", "http://www.youtube.com/watch?v=nfGV32RNkhw" ),
readyStatePoll = function() {
if ( popcorn1.media.readyState !== 4 || popcorn2.media.readyState !== 4 ) {
if ( popcorn1.media.readyState !== 4 || popcorn2.media.readyState !== 4 || popcorn3.media.readyState !== 4 ) {
setTimeout( readyStatePoll, 10 );
} else {
@ -456,16 +457,21 @@ asyncTest( "Player height and width", function() {
equal( popcorn2.media.children[ 0 ].getAttribute( "width" ), 640, "Youtube player min width is 640" );
equal( popcorn2.media.children[ 0 ].getAttribute( "height" ), 390, "Youtube player min height is 390" );
equal( popcorn3.media.children[ 0 ].width, 800, "Youtube correctly gets width style of container (800)" );
equal( popcorn3.media.children[ 0 ].height, 450, "Youtube correctly gets height style of container (450)" );
popcorn1.destroy();
popcorn2.destroy();
popcorn3.destroy();
start();
}
};
popcorn1.volume( 0 );
popcorn2.volume( 0 );
popcorn3.volume( 0 );
readyStatePoll();
});