Skip to content

Commit

Permalink
Updated the ParserJSON unit tests to work around a Safari issue [#822]
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher De Cairos committed Nov 18, 2011
2 parents 654c2c1 + c112ffd commit 1d0c3d7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions parsers/parserJSON/popcorn.parserJSON.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@ test("Popcorn 0.3 JSON Parser Plugin", function () {
}

poppercorn.parseJSON("data/video.json");
poppercorn.pause();

expect(expects);

stop( 10000 );


trackData = poppercorn.data;
trackEvents = trackData.trackEvents;

Popcorn.xhr({
url: 'data/video.json',
success: function( data ) {

var idx = 0;
var idx = 1;

Popcorn.forEach( data.json.data, function (dataObj) {

Popcorn.forEach( dataObj, function ( obj, key ) {

equals( trackData.history[idx].indexOf(key), 0, "history item '" + trackData.history[idx] + "' matches data key '"+ key+ "' at correct index" );
plus();

Expand All @@ -46,18 +45,16 @@ test("Popcorn 0.3 JSON Parser Plugin", function () {
}
});

poppercorn.listen("timeupdate", function ( event ) {


if ( Math.round( this.currentTime()) === 3 && !finished ) {
poppercorn.exec( 3, function() {
if ( !finished ) {

finished = true;

equals( trackEvents.byStart.length, numLoadingEvents + 2 , "trackEvents.byStart.length === (5 loaded, 2 padding) " );
equals( trackEvents.byStart.length, numLoadingEvents + 3 , "trackEvents.byStart.length === (5 loaded, 2 padding) " );
plus();


equals( $("#video-iframe-container").children().length, 2, '$("#video-iframe-container").children().length' )
equals( $("#video-iframe-container").children().length, 2, '$("#video-iframe-container").children().length' );
plus();
equals( $("#video-map-container").children().length, 1, '$("#video-map-container").children().length' );
plus();
Expand All @@ -69,7 +66,9 @@ test("Popcorn 0.3 JSON Parser Plugin", function () {
}
});

poppercorn.currentTime(0).play()
poppercorn.listen( "canplayall", function() {
this.play();
});
});

test("Popcorn 0.3 JSON Parser Plugin - AUDIO", function () {
Expand Down Expand Up @@ -102,6 +101,7 @@ test("Popcorn 0.3 JSON Parser Plugin - AUDIO", function () {
start();
// clean up added events after tests
clearInterval( interval );
audiocorn.pause();
}
}

Expand Down

0 comments on commit 1d0c3d7

Please sign in to comment.