[#t541] Changed timeout from 250ms to 50ms and also added some array padding and other styling fixes

This commit is contained in:
David Seifried 2011-06-20 14:40:45 -04:00
Родитель 40a97fee6f
Коммит e09f2e0a3c
3 изменённых файлов: 18 добавлений и 18 удалений

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

@ -87,4 +87,4 @@
This demo showcases basic functionality of a player. It is a shell of an HTMLMediaElement with basic timing routines.<br />
At 2 seconds, the phrase "2 seconds reached" will appear beside 'Event Output'<br />
</body>
</html>
</html>

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

@ -59,7 +59,7 @@
setTimeout( function() {
self.timeupdate.call( self );
}, 250 );
}, 50 );
},
// By default, assumes this.resource is a DOM Element
@ -70,7 +70,7 @@
// Add an event listener to the object
addEventListener: function( evtName, fn ) {
if ( !this._events[evtName] ) {
if ( !this._events[ evtName ] ) {
this._events[evtName] = [];
}
@ -96,7 +96,7 @@
}
}
Popcorn.forEach( this._events[eventName], function( val ) {
Popcorn.forEach( this._events[ eventName ], function( val ) {
val.call( self, evt, self );
});
},
@ -129,13 +129,13 @@
if ( elem.currentStyle ) {
// IE syntax
return elem.currentStyle[prop];
return elem.currentStyle[ prop ];
} else if ( global.getComputedStyle ) {
// Firefox, Chrome et. al
return doc.defaultView.getComputedStyle( elem, null ).getPropertyValue( prop );
} else {
// Fallback, just in case
return elem.style[prop];
return elem.style[ prop ];
}
}
};

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

@ -55,7 +55,7 @@ test( "API", function () {
stop( 10000 );
Popcorn.forEach( members, function ( type, prop ) {
ok( typeof player[prop] === type, "player." + prop + " is type: " + type );
ok( typeof player[ prop ] === type, "player." + prop + " is type: " + type );
plus();
});
});
@ -78,18 +78,18 @@ test( "Default Functionality", function () {
}
}
player._resource = document.getElementById('player_1');
player._resource = document.getElementById( 'player_1' );
dimensions = player.getBoundingClientRect();
Popcorn.forEach( expectedVals, function() {
expects+= 2;
expects += 2;
});
expect( expects );
stop( 1000 );
Popcorn.forEach( expectedVals, function( val, prop ) {
equals( player.getStyle( prop ), val+'px', "Style '" + prop + "' correctly got" );
equals( player.getStyle( prop ), val + 'px', "Style '" + prop + "' correctly got" );
plus();
equals( dimensions[prop], val, "Bounding Client " + prop + " works" );
@ -137,7 +137,7 @@ test( "Extension and Method Overriding", function () {
}
}
expect(expects);
expect( expects );
stop( 4000 );
Popcorn.extend( player, {
@ -150,7 +150,7 @@ test( "Extension and Method Overriding", function () {
plus();
// Must dispatch event so event listeners can work!
this.dispatchEvent("timeupdate");
this.dispatchEvent( "timeupdate" );
// We don't want to cue custom timing loop using setTimeout because we only want this to run once
}
@ -162,12 +162,12 @@ test( "Extension and Method Overriding", function () {
});
popcorn = Popcorn( playerForPopcorn )
.exec( 2, function() {
ok( Math.abs(player2.currentTime() - playerForPopcorn.currentTime) < 0.2, "Time update is within a reasonable range" );
plus();
ok( true, "Exec triggereed from popcorn after 2 seconds" );
plus();
});
.exec( 2, function() {
ok( Math.abs( player2.currentTime() - playerForPopcorn.currentTime ) < 0.2, "Time update is within a reasonable range" );
plus();
ok( true, "Exec triggereed from popcorn after 2 seconds" );
plus();
});
player.load();
player2.play();