1
0
mirror of synced 2024-11-25 06:16:08 +03:00

Added tests for jQuery calls to Select2

This adds a test that covers the change made in
c2c1aeef31.
This commit is contained in:
Kevin Brown 2016-03-27 15:16:22 -04:00
parent c2c1aeef31
commit ac254ff68d
2 changed files with 29 additions and 0 deletions

View File

@ -14,6 +14,7 @@
<script src="helpers.js" type="text/javascript"></script>
<script src="integration/jquery-calls.js" type="text/javascript"></script>
<script src="integration/select2-methods.js" type="text/javascript"></script>
</body>
</html>

28
tests/integration/jquery-calls.js vendored Normal file
View File

@ -0,0 +1,28 @@
test('multiple elements with arguments works', function (assert) {
var $ = require('jquery');
require('jquery.select2');
var $first = $(
'<select>' +
'<option>1</option>' +
'<option>2</option>' +
'</select>'
);
var $second = $first.clone();
var $both = $first.add($second);
$both.select2();
$both.select2('val', '2');
assert.equal(
$first.val(),
'2',
'The call should change the value on the first element'
);
assert.equal(
$second.val(),
'2',
'The call should also change the value on the second element'
);
});