How to use the select2/defaults.defaults function in select2

To help you get started, we’ve selected a few select2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github select2 / select2 / tests / options / ajax-tests.js View on Github external
test('more than one default option can be changed via set()', function(assert) {
  var defaults = require('select2/defaults');
  var ajaxDelay = 123;
  var dataDataType = 'xml';
  defaults.set('ajax--delay', ajaxDelay);
  defaults.set('ajax--data-type', dataDataType);

  assert.equal(
      defaults.defaults.ajax.delay,
      ajaxDelay,
      'Both ajax.delay and ajax.dataType present in defaults');
  assert.equal(
    defaults.defaults.ajax.dataType,
    dataDataType,
    'Both ajax.delay and ajax.dataType present in defaults');
  defaults.reset();
});
github select2 / select2 / tests / options / ajax-tests.js View on Github external
test('more than one default option can be changed via set()', function(assert) {
  var defaults = require('select2/defaults');
  var ajaxDelay = 123;
  var dataDataType = 'xml';
  defaults.set('ajax--delay', ajaxDelay);
  defaults.set('ajax--data-type', dataDataType);

  assert.equal(
      defaults.defaults.ajax.delay,
      ajaxDelay,
      'Both ajax.delay and ajax.dataType present in defaults');
  assert.equal(
    defaults.defaults.ajax.dataType,
    dataDataType,
    'Both ajax.delay and ajax.dataType present in defaults');
  defaults.reset();
});
github select2 / select2 / tests / options / translation-tests.js View on Github external
test('partial dictonaries are reset when default reset', function (assert) {
  Defaults.set('language', {
    test: 'testing'
  });

  Defaults.reset();

  assert.ok(
    !Defaults.defaults.language.test,
    'The partial dictionary should have been reset'
  );
});