No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stopPropagation-tests.js 931B

123456789101112131415161718192021222324252627282930313233
  1. module('Dropdown - Stoping event propagation');
  2. var Dropdown = require('select2/dropdown');
  3. var StopPropagation = require('select2/dropdown/stopPropagation');
  4. var $ = require('jquery');
  5. var Options = require('select2/options');
  6. var Utils = require('select2/utils');
  7. var CustomDropdown = Utils.Decorate(Dropdown, 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 dropdown = new CustomDropdown($('#qunit-fixture select'), options);
  14. var $dropdown = dropdown.render();
  15. dropdown.bind(container, $container);
  16. $container.append($dropdown);
  17. $container.on('click', function () {
  18. assert.ok(false, 'The click event should have been stopped');
  19. });
  20. $dropdown.trigger('click');
  21. assert.ok(true, 'Something went wrong if this failed');
  22. });