d976f1c576
This adds tests for 983cd8e765
.
32 lines
638 B
JavaScript
32 lines
638 B
JavaScript
module('Defaults - Ajax');
|
|
|
|
test('options are merged recursively with default options', function (assert) {
|
|
var defaults = require('select2/defaults');
|
|
|
|
var ajaxDelay = 250;
|
|
var ajaxUrl = 'http://www.test.com';
|
|
|
|
var mergedOptions;
|
|
|
|
defaults.set('ajax--delay', ajaxDelay);
|
|
|
|
mergedOptions = defaults.apply({
|
|
ajax: {
|
|
url: ajaxUrl
|
|
}
|
|
});
|
|
|
|
assert.equal(
|
|
mergedOptions.ajax.delay,
|
|
ajaxDelay,
|
|
'Ajax default options are present on the merged options'
|
|
);
|
|
|
|
assert.equal(
|
|
mergedOptions.ajax.url,
|
|
ajaxUrl,
|
|
'Ajax provided options are present on the merged options'
|
|
);
|
|
|
|
defaults.reset();
|
|
}); |