Test against jQuery 3.4.1 (#5531)
* Update tests to be compatible with jQuery 3.0.0 There was a change in jQuery 3 that ensures that the return value of `.val()` on a multiple select is always an array. This is a breaking change from previous versions, where `null` or `undefined` were returned in these scenarios. Because we cannot `assert.equal` on a list of possible values, these assertions were switched to `assert.ok` which should be good enough. * Properly strip out units in positioning tests Before we were assuming that there were no units, and only were we stripping them out if we were expecting 3 digits. Now we just strip out all non-digit characters, so that should do the job and get us what we want. There was a change in jQuery 3.2.0 that caused the units to be returned in these specific calls. They were not previously being returned, so this was not actually an issue. * Add automated testing against jQuery 3.4.1 No tests appear to be currently failing.
This commit is contained in:
parent
d66e55dd9e
commit
9491e1aae2
@ -193,7 +193,10 @@ test('multiple sets the value', function (assert) {
|
|||||||
|
|
||||||
var data = new ArrayData($select, arrayOptions);
|
var data = new ArrayData($select, arrayOptions);
|
||||||
|
|
||||||
assert.equal($select.val(), null);
|
assert.ok(
|
||||||
|
$select.val() == null || $select.val().length == 0,
|
||||||
|
'nothing should be selected'
|
||||||
|
);
|
||||||
|
|
||||||
data.select({
|
data.select({
|
||||||
id: 'default',
|
id: 'default',
|
||||||
|
@ -130,7 +130,10 @@ test('multiple sets the value', function (assert) {
|
|||||||
|
|
||||||
var data = new SelectData($select, selectOptions);
|
var data = new SelectData($select, selectOptions);
|
||||||
|
|
||||||
assert.equal($select.val(), null);
|
assert.ok(
|
||||||
|
$select.val() == null || $select.val().length == 0,
|
||||||
|
'nothing should be selected'
|
||||||
|
);
|
||||||
|
|
||||||
data.select({
|
data.select({
|
||||||
id: 'Two',
|
id: 'Two',
|
||||||
|
@ -106,7 +106,7 @@ test('dropdown is positioned down with static margins', function (assert) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
$dropdown.css('top').substring(0, 2),
|
$dropdown.css('top').replace(/\D+/, ''),
|
||||||
$container.outerHeight() + 5,
|
$container.outerHeight() + 5,
|
||||||
'The offset should be 5px at the top'
|
'The offset should be 5px at the top'
|
||||||
);
|
);
|
||||||
@ -164,7 +164,7 @@ test('dropdown is positioned down with absolute offsets', function (assert) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
$dropdown.css('top').substring(0, 2),
|
$dropdown.css('top').replace(/\D+/, ''),
|
||||||
$container.outerHeight(),
|
$container.outerHeight(),
|
||||||
'There should not be an extra top offset'
|
'There should not be an extra top offset'
|
||||||
);
|
);
|
||||||
|
21
tests/integration-jq3.html
Normal file
21
tests/integration-jq3.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="vendor/qunit-1.23.1.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../../dist/css/select2.css" type="text/css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="qunit"></div>
|
||||||
|
<div id="qunit-fixture"></div>
|
||||||
|
|
||||||
|
<script src="vendor/qunit-1.23.1.js" type="text/javascript"></script>
|
||||||
|
<script src="vendor/jquery-3.4.1.js" type="text/javascript"></script>
|
||||||
|
<script src="../dist/js/select2.full.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="helpers.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="integration/dom-changes.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>
|
97
tests/unit-jq3.html
Normal file
97
tests/unit-jq3.html
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="vendor/qunit-1.23.1.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../../dist/css/select2.css" type="text/css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="qunit"></div>
|
||||||
|
<div id="qunit-fixture">
|
||||||
|
<div class="event-container">
|
||||||
|
<select></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<select class="single">
|
||||||
|
<option>One</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="single-empty"></select>
|
||||||
|
|
||||||
|
<select class="single-with-placeholder">
|
||||||
|
<option>placeholder</option>
|
||||||
|
<option>One</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="multiple" multiple="multiple">
|
||||||
|
<option>One</option>
|
||||||
|
<option>Two</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="groups">
|
||||||
|
<optgroup label="Test">
|
||||||
|
<option value="one">One</option>
|
||||||
|
<option value="two">Two</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="Empty"></optgroup>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="duplicates">
|
||||||
|
<option value="one">One</option>
|
||||||
|
<option value="two">Two</option>
|
||||||
|
<option value="one">Uno</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="duplicates-multi" multiple="multiple">
|
||||||
|
<option value="one">One</option>
|
||||||
|
<option value="two">Two</option>
|
||||||
|
<option value="one">Uno</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select class="user-defined"></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="vendor/qunit-1.23.1.js" type="text/javascript"></script>
|
||||||
|
<script src="vendor/jquery-3.4.1.js" type="text/javascript"></script>
|
||||||
|
<script src="../dist/js/select2.full.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="helpers.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="a11y/selection-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="a11y/search-tests.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="data/array-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="data/base-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="data/inputData-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="data/select-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="data/tags-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="data/tokenizer-tests.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="data/maximumInputLength-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="data/maximumSelectionLength-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="data/minimumInputLength-tests.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="dropdown/dropdownCss-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="dropdown/positioning-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="dropdown/selectOnClose-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="dropdown/stopPropagation-tests.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="options/ajax-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="options/data-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="options/deprecated-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="options/translation-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="options/width-tests.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="results/focusing-tests.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="selection/allowClear-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="selection/containerCss-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="selection/multiple-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="selection/placeholder-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="selection/search-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="selection/single-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="selection/stopPropagation-tests.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script src="utils/decorator-tests.js" type="text/javascript"></script>
|
||||||
|
<script src="utils/escapeMarkup-tests.js" type="text/javascript"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
10598
tests/vendor/jquery-3.4.1.js
vendored
Normal file
10598
tests/vendor/jquery-3.4.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user