Skip to content

Commit

Permalink
@heff removed playerOptions from plugin options because it created an…
Browse files Browse the repository at this point in the history
… inconsistency in plugin inits. closes #2532
  • Loading branch information
heff committed Sep 2, 2015
1 parent 0f6abfd commit 3fb786e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ CHANGELOG
* @dmlap expose start and end buffered times ([view](https://github.com/videojs/video.js/pull/2501))
* @heff fixed a number of console errors after testing ([view](https://github.com/videojs/video.js/pull/2513))
* @gkatsev made the sass files available via npm in src/css ([view](https://github.com/videojs/video.js/pull/2546))
* @heff removed playerOptions from plugin options because it created an inconsistency in plugin inits ([view](https://github.com/videojs/video.js/pull/2532))

--------------------

Expand Down
1 change: 0 additions & 1 deletion src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class Player extends Component {
let plugins = options.plugins;

Object.getOwnPropertyNames(plugins).forEach(function(name){
plugins[name].playerOptions = playerOptionsCopy;
if (typeof this[name] === 'function') {
this[name](plugins[name]);
} else {
Expand Down
24 changes: 12 additions & 12 deletions test/unit/plugins.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Plugin from '../../src/js/plugins.js';
import registerPlugin from '../../src/js/plugins.js';
import Player from '../../src/js/player.js';
import TestHelpers from './test-helpers.js';
import window from 'global/window';
Expand All @@ -8,12 +8,12 @@ q.module('Plugins');
test('Plugin should get initialized and receive options', function(){
expect(2);

Plugin('myPlugin1', function(options){
registerPlugin('myPlugin1', function(options){
ok(true, 'Plugin initialized');
ok(options['test'], 'Option passed through');
});

Plugin('myPlugin2', function(options){
registerPlugin('myPlugin2', function(options){
ok(false, 'Plugin initialized and should not have been');
});

Expand All @@ -31,7 +31,7 @@ test('Plugin should get initialized and receive options', function(){
test('Plugin should have the option of being initilized outside of player init', function(){
expect(3);

Plugin('myPlugin3', function(options){
registerPlugin('myPlugin3', function(options){
ok(true, 'Plugin initialized after player init');
ok(options['test'], 'Option passed through');
});
Expand All @@ -50,7 +50,7 @@ test('Plugin should have the option of being initilized outside of player init',
test('Plugin should be able to add a UI component', function(){
expect(2);

Plugin('myPlugin4', function(options){
registerPlugin('myPlugin4', function(options){
ok((this instanceof Player), 'Plugin executed in player scope by default');
this.addChild('component');
});
Expand All @@ -72,21 +72,21 @@ test('Plugin should overwrite plugin of same name', function(){
v3Called = 0;

// Create initial plugin
Plugin('myPlugin5', function(options){
registerPlugin('myPlugin5', function(options){
v1Called++;
});
var player = TestHelpers.makePlayer({});
player['myPlugin5']({});

// Overwrite and create new player
Plugin('myPlugin5', function(options){
registerPlugin('myPlugin5', function(options){
v2Called++;
});
var player2 = TestHelpers.makePlayer({});
player2['myPlugin5']({});

// Overwrite and init new version on existing player
Plugin('myPlugin5', function(options){
registerPlugin('myPlugin5', function(options){
v3Called++;
});
player2['myPlugin5']({});
Expand All @@ -109,7 +109,7 @@ test('Plugins should get events in registration order', function() {
var name;
var player = TestHelpers.makePlayer({});
var plugin = function (name) {
Plugin(name, function (opts) {
registerPlugin(name, function (opts) {
this.on('test', function (event) {
order.push(name);
});
Expand All @@ -123,7 +123,7 @@ test('Plugins should get events in registration order', function() {
plugin(name);
}

Plugin('testerPlugin', function (opts) {
registerPlugin('testerPlugin', function (opts) {
this.trigger('test');
});

Expand All @@ -141,7 +141,7 @@ test('Plugins should not get events after stopImmediatePropagation is called', f
var name;
var player = TestHelpers.makePlayer({});
var plugin = function (name) {
Plugin(name, function (opts) {
registerPlugin(name, function (opts) {
this.on('test', function (event) {
order.push(name);
event.stopImmediatePropagation();
Expand All @@ -156,7 +156,7 @@ test('Plugins should not get events after stopImmediatePropagation is called', f
plugin(name);
}

Plugin('testerPlugin', function (opts) {
registerPlugin('testerPlugin', function (opts) {
this.trigger('test');
});

Expand Down

0 comments on commit 3fb786e

Please sign in to comment.