Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

stopPropagation-tests.js 972B

123456789101112131415161718192021222324252627282930313233
  1. module('Selection containers - Stoping event propagation');
  2. var SingleSelection = require('select2/selection/single');
  3. var StopPropagation = require('select2/selection/stopPropagation');
  4. var $ = require('jquery');
  5. var Options = require('select2/options');
  6. var Utils = require('select2/utils');
  7. var CutomSelection = Utils.Decorate(SingleSelection, StopPropagation);
  8. var options = new Options();
  9. test('click event does not propagate', function (assert) {
  10. assert.expect(1);
  11. var $container = $('#qunit-fixture .event-container');
  12. var container = new MockContainer();
  13. var selection = new CutomSelection($('#qunit-fixture select'), options);
  14. var $selection = selection.render();
  15. selection.bind(container, $container);
  16. $container.append($selection);
  17. $container.on('click', function () {
  18. assert.ok(false, 'The click event should have been stopped');
  19. });
  20. $selection.trigger('click');
  21. assert.ok(true, 'Something went wrong if this failed');
  22. });