Skip to content

Commit

Permalink
[#1328] Popcorn instance properly passed to setup again
Browse files Browse the repository at this point in the history
  • Loading branch information
mjschranz committed Sep 7, 2012
1 parent e0e319f commit 6119309
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion popcorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@
obj.data.history.push( track._id );

// Trigger _setup method if exists
track._natives._setup && track._natives._setup.call( this, track );
track._natives._setup && track._natives._setup.call( obj, track );
}

track.start = Popcorn.util.toSeconds( track.start, obj.options.framerate );
Expand Down
32 changes: 32 additions & 0 deletions test/popcorn.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3672,6 +3672,38 @@ asyncTest( "In/Out aliases", function() {
});
});

asyncTest( "Popcorn instance integrity inside natives", 4, function() {
var p = Popcorn( "#video" ),
id = "test-id";

Popcorn.plugin( "integrityTest", {
_setup: function( options ) {
ok( this === p, "Popcorn instance accessible in plugin _setup" );
},
start: function( event, options ) {
ok( this === p, "Popcorn instance accessible in plugin start" );
},
end: function( event, options ) {
ok( this === p, "Popcorn instance accessible in plugin end" );
p.removeTrackEvent( id );
},
_teardown: function( options ) {
ok( this === p, "Popcorn instance accessible in plugin _teardown" );
}
});

p.cue( 4.5, function() {
Popcorn.removePlugin( "integrityTest" );
p.currentTime( 0 );
p.destroy();
start();
});

p.integrityTest( id, { start: 3, end: 4 } );
p.play( 2 );

});

module( "Popcorn TrackEvents" );
test( "Functions", 19, function() {

Expand Down

0 comments on commit 6119309

Please sign in to comment.