How to use the select2/keys.BACKSPACE 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 / selection / search-tests.js View on Github external
selection.update([
    {
      id: '1',
      text: 'One'
    }
  ]);

  var $search = $selection.find('input');
  var $choices = $selection.find('.select2-selection__choice');

  assert.equal($search.length, 1, 'The search was visible');
  assert.equal($choices.length, 1, 'The choice was rendered');

  // Trigger the backspace on the search
  var backspace = $.Event('keydown', {
    which: KEYS.BACKSPACE
  });
  $search.trigger(backspace);
});

select2

Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.

MIT
Latest version published 2 years ago

Package Health Score

84 / 100
Full package analysis