1. Some more rigorous tests
2. Whitespace fixes
3. Used Popcorn.dom.find instead of doc.getEl()
This commit is contained in:
secretrobotron 2012-05-09 15:35:56 -04:00
Родитель 947b8318d9
Коммит 08e56cf9f3
2 изменённых файлов: 21 добавлений и 6 удалений

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

@ -404,13 +404,13 @@
if ( !targetType ) {
targetType = ( target.charAt( 0 ) === "#" ? document.getElementById( target.substring( 1 ) ) : document.getElementById( target ) ).nodeName;
targetType = Popcorn.dom.find( target ).nodeName;
}
// If src is an array, add <source>'s
if ( typeof( src ) !== "string" && src.length ) {
for ( var i = 0; i < src.length; ++i ) {
sourceNode = document.createElement( "source" );

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

@ -333,7 +333,7 @@ asyncTest( "Popcorn.smart - audio and video elements", function() {
});
asyncTest( "Popcorn.smart - multiple sources for HTML5 media", function() {
expect( 6 );
expect( 19 );
var instanceDiv,
count = 0,
@ -345,13 +345,28 @@ asyncTest( "Popcorn.smart - multiple sources for HTML5 media", function() {
instanceDiv = document.getElementById( "multi-div" );
ok( instanceDiv.firstChild && instanceDiv.firstChild.childNodes.length === 3, "multi-div has 3 children" );
ok( instanceDiv.firstChild.childNodes[ 0 ].nodeName === "SOURCE", "multi-div has <source> children" );
ok( instanceDiv.firstChild.childNodes[ 0 ].nodeName === "SOURCE", "multi-div has <source> children [ 0 ]" );
ok( instanceDiv.firstChild.childNodes[ 1 ].nodeName === "SOURCE", "multi-div has <source> children [ 1 ]" );
ok( instanceDiv.firstChild.childNodes[ 2 ].nodeName === "SOURCE", "multi-div has <source> children [ 2 ]" );
ok( instanceDiv.firstChild.childNodes[ 0 ].getAttribute( "type" ) === "video/ogv", "source[ 0 ] is correct type" );
ok( instanceDiv.firstChild.childNodes[ 1 ].getAttribute( "type" ) === "video/webm", "source[ 1 ] is correct type" );
ok( instanceDiv.firstChild.childNodes[ 2 ].getAttribute( "type" ) === "video/mp4", "source[ 2 ] is correct type" );
instanceDiv = document.getElementById( "multi-video" );
ok( instanceDiv.childNodes.length === 3, "multi-video has 3 children" );
ok( instanceDiv.childNodes[ 0 ].nodeName === "SOURCE", "multi-video has <source> children" );
ok( instanceDiv.childNodes[ 0 ].nodeName === "SOURCE", "multi-video has <source> children [ 0 ]" );
ok( instanceDiv.childNodes[ 1 ].nodeName === "SOURCE", "multi-video has <source> children [ 1 ]" );
ok( instanceDiv.childNodes[ 2 ].nodeName === "SOURCE", "multi-video has <source> children [ 2 ]" );
ok( instanceDiv.childNodes[ 0 ].getAttribute( "type" ) === "video/ogv", "source[ 0 ] is correct type" );
ok( instanceDiv.childNodes[ 1 ].getAttribute( "type" ) === "video/webm", "source[ 1 ] is correct type" );
ok( instanceDiv.childNodes[ 2 ].getAttribute( "type" ) === "video/mp4", "source[ 2 ] is correct type" );
instanceDiv = document.getElementById( "multi-audio" );
ok( instanceDiv.childNodes.length === 2, "multi-audio has 2 children" );
ok( instanceDiv.childNodes[ 0 ].nodeName === "SOURCE", "multi-audio has <source> children" );
ok( instanceDiv.childNodes[ 0 ].nodeName === "SOURCE", "multi-audio has <source> children [ 0 ]" );
ok( instanceDiv.childNodes[ 1 ].nodeName === "SOURCE", "multi-audio has <source> children [ 1 ]" );
ok( instanceDiv.childNodes[ 0 ].getAttribute( "type" ) === "audio/ogg", "source[ 0 ] is correct type" );
ok( instanceDiv.childNodes[ 1 ].getAttribute( "type" ) === "audio/mp4", "source[ 1 ] is correct type" );
start();