jquery-calls.js 584 B

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