jquery-calls.js 609 B

123456789101112131415161718192021222324252627282930
  1. module('select2(val)');
  2. test('multiple elements with arguments works', function (assert) {
  3. var $ = require('jquery');
  4. require('jquery.select2');
  5. var $first = $(
  6. '<select>' +
  7. '<option>1</option>' +
  8. '<option>2</option>' +
  9. '</select>'
  10. );
  11. var $second = $first.clone();
  12. var $both = $first.add($second);
  13. $both.select2();
  14. $both.select2('val', '2');
  15. assert.equal(
  16. $first.val(),
  17. '2',
  18. 'The call should change the value on the first element'
  19. );
  20. assert.equal(
  21. $second.val(),
  22. '2',
  23. 'The call should also change the value on the second element'
  24. );
  25. });