2015-03-26 06:43:41 +02:00
|
|
|
import * as Util from '../../src/js/util.js';
|
2015-03-11 03:01:11 +02:00
|
|
|
|
2015-03-26 06:43:41 +02:00
|
|
|
q.module('Util');
|
2013-12-03 04:03:32 +03:00
|
|
|
|
|
|
|
test('should merge options objects', function(){
|
|
|
|
var ob1, ob2, ob3;
|
|
|
|
|
|
|
|
ob1 = {
|
|
|
|
a: true,
|
|
|
|
b: { b1: true, b2: true, b3: true },
|
|
|
|
c: true
|
|
|
|
};
|
|
|
|
|
|
|
|
ob2 = {
|
|
|
|
// override value
|
|
|
|
a: false,
|
|
|
|
// merge sub-option values
|
|
|
|
b: { b1: true, b2: false, b4: true },
|
|
|
|
// add new option
|
|
|
|
d: true
|
|
|
|
};
|
|
|
|
|
2015-03-11 03:01:11 +02:00
|
|
|
ob3 = Util.mergeOptions(ob1, ob2);
|
2013-12-03 04:03:32 +03:00
|
|
|
|
|
|
|
deepEqual(ob3, {
|
|
|
|
a: false,
|
|
|
|
b: { b1: true, b2: false, b3: true, b4: true },
|
|
|
|
c: true,
|
|
|
|
d: true
|
|
|
|
}, 'options objects merged correctly');
|
2015-03-11 03:01:11 +02:00
|
|
|
});
|