Added tests for jQuery calls to Select2
This adds a test that covers the change made in
c2c1aeef31
.
This commit is contained in:
parent
c2c1aeef31
commit
ac254ff68d
@ -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
28
tests/integration/jquery-calls.js
vendored
Normal 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'
|
||||
);
|
||||
});
|
Loading…
Reference in New Issue
Block a user