1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-07 01:07:13 +02:00

Changed to vjs.obj.function naming for object related functions.

Updated mergeOptions to just options.
This commit is contained in:
Steve Heffernan
2013-01-25 17:36:40 -08:00
parent c7d3b9ebf9
commit dc18f475f8
13 changed files with 146 additions and 92 deletions

View File

@ -37,24 +37,25 @@ test('should init child coponents from options', function(){
});
test('should do a deep merge of child options', function(){
var compDefaultOptions = {
'children': {
// Create a default option for component
vjs.Component.prototype.options_ = {
'example': {
'childOne': { 'foo': 'bar', 'asdf': 'fdsa' },
'childTwo': {},
'childThree': {}
}
}
var compInitOptions = {
'children': {
var comp = new vjs.Component(getFakePlayer(), {
'example': {
'childOne': { 'foo': 'baz', 'abc': '123' },
'childThree': null,
'childFour': {}
}
}
});
var mergedOptions = vjs.Component.prototype.mergeOptions(compDefaultOptions, compInitOptions);
var children = mergedOptions['children'];
var mergedOptions = comp.options();
var children = mergedOptions['example'];
ok(children['childOne']['foo'] === 'baz', 'value three levels deep overridden');
ok(children['childOne']['asdf'] === 'fdsa', 'value three levels deep maintained');
@ -62,6 +63,11 @@ test('should do a deep merge of child options', function(){
ok(children['childTwo'], 'object two levels deep maintained');
ok(children['childThree'] === null, 'object two levels deep removed');
ok(children['childFour'], 'object two levels deep added');
ok(vjs.Component.prototype.options_['example']['childOne']['foo'] === 'bar', 'prototype options were not overridden');
// Reset default component options to none
vjs.Component.prototype.options_ = null;
});
test('should dispose of component and children', function(){