Combine tests into common files
This groups tests into common HTML files so they can be run more quickly. This also reduces the number of Sauce Labs instances that have to be run, as one instance was previously spun up for each file.
This commit is contained in:
parent
a2a99e64ba
commit
72e5c2a50d
23
tests/data.html
Normal file
23
tests/data.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../vendor/jquery-2.1.0.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="data/base-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>
|
||||
</body>
|
||||
</html>
|
@ -1,21 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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">
|
||||
<select></select>
|
||||
</div>
|
||||
|
||||
<script src="../vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="base-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -5,22 +5,22 @@ var $ = require('jquery');
|
||||
var Options = require('select2/options');
|
||||
var Utils = require('select2/utils');
|
||||
|
||||
function StubData () {
|
||||
function MaximumInputStub () {
|
||||
this.called = false;
|
||||
}
|
||||
|
||||
StubData.prototype.query = function (params, callback) {
|
||||
MaximumInputStub.prototype.query = function (params, callback) {
|
||||
this.called = true;
|
||||
};
|
||||
|
||||
var MaximumData = Utils.Decorate(StubData, MaximumInputLength);
|
||||
var MaximumInputData = Utils.Decorate(MaximumInputStub, MaximumInputLength);
|
||||
|
||||
test('0 never displays the notice', function (assert) {
|
||||
var zeroOptions = new Options({
|
||||
maximumInputLength: 0
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, zeroOptions);
|
||||
var data = new MaximumInputData(null, zeroOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -32,7 +32,7 @@ test('0 never displays the notice', function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, zeroOptions);
|
||||
data = new MaximumInputData(null, zeroOptions);
|
||||
|
||||
data.query({
|
||||
term: 'test'
|
||||
@ -46,7 +46,7 @@ test('< 0 never displays the notice', function (assert) {
|
||||
maximumInputLength: -1
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, negativeOptions);
|
||||
var data = new MaximumInputData(null, negativeOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -58,7 +58,7 @@ test('< 0 never displays the notice', function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, negativeOptions);
|
||||
data = new MaximumInputData(null, negativeOptions);
|
||||
|
||||
data.query({
|
||||
term: 'test'
|
||||
@ -72,7 +72,7 @@ test('triggers when input is too long', function (assert) {
|
||||
maximumInputLength: 1
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, options);
|
||||
var data = new MaximumInputData(null, options);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(true, 'The event should be triggered.');
|
||||
@ -82,7 +82,7 @@ test('triggers when input is too long', function (assert) {
|
||||
term: 'no'
|
||||
});
|
||||
|
||||
assert.ok(!data.called);
|
||||
assert.ok(!data.called, 'The adapter should not be called');
|
||||
});
|
||||
|
||||
test('does not trigger when equal', function (assert) {
|
||||
@ -90,7 +90,7 @@ test('does not trigger when equal', function (assert) {
|
||||
maximumInputLength: 10
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, options);
|
||||
var data = new MaximumInputData(null, options);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'The event should not be triggered.');
|
||||
@ -108,7 +108,7 @@ test('does not trigger when less', function (assert) {
|
||||
maximumInputLength: 10
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, options);
|
||||
var data = new MaximumInputData(null, options);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'The event should not be triggered.');
|
||||
@ -126,7 +126,7 @@ test('works with null term', function (assert) {
|
||||
maximumInputLength: 1
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, options);
|
||||
var data = new MaximumInputData(null, options);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'The event should not be triggered');
|
||||
|
@ -1,19 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="maximumInputLength-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -6,31 +6,34 @@ var $ = require('jquery');
|
||||
var Options = require('select2/options');
|
||||
var Utils = require('select2/utils');
|
||||
|
||||
function StubData () {
|
||||
function MaximumSelectionStub () {
|
||||
this.called = false;
|
||||
this.currentData = [];
|
||||
}
|
||||
|
||||
StubData.prototype.current = function (callback) {
|
||||
MaximumSelectionStub.prototype.current = function (callback) {
|
||||
callback(this.currentData);
|
||||
};
|
||||
|
||||
StubData.prototype.val = function (val) {
|
||||
MaximumSelectionStub.prototype.val = function (val) {
|
||||
this.currentData.push(val);
|
||||
};
|
||||
|
||||
StubData.prototype.query = function (params, callback) {
|
||||
MaximumSelectionStub.prototype.query = function (params, callback) {
|
||||
this.called = true;
|
||||
};
|
||||
|
||||
var MaximumData = Utils.Decorate(StubData, MaximumSelectionLength);
|
||||
var MaximumSelectionData = Utils.Decorate(
|
||||
MaximumSelectionStub,
|
||||
MaximumSelectionLength
|
||||
);
|
||||
|
||||
test('0 never displays the notice', function (assert) {
|
||||
var zeroOptions = new Options({
|
||||
maximumSelectionLength: 0
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, zeroOptions);
|
||||
var data = new MaximumSelectionData(null, zeroOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -42,7 +45,7 @@ test('0 never displays the notice', function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, zeroOptions);
|
||||
data = new MaximumSelectionData(null, zeroOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -56,7 +59,7 @@ test('0 never displays the notice', function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, zeroOptions);
|
||||
data = new MaximumSelectionData(null, zeroOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -77,7 +80,7 @@ test('< 0 never displays the notice', function (assert) {
|
||||
maximumSelectionLength: -1
|
||||
});
|
||||
|
||||
var data = new MaximumData(null, negativeOptions);
|
||||
var data = new MaximumSelectionData(null, negativeOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -89,7 +92,7 @@ test('< 0 never displays the notice', function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, negativeOptions);
|
||||
data = new MaximumSelectionData(null, negativeOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -103,7 +106,7 @@ test('< 0 never displays the notice', function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, negativeOptions);
|
||||
data = new MaximumSelectionData(null, negativeOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -123,7 +126,7 @@ test('triggers when >= 1 selection' , function (assert) {
|
||||
var maxOfOneOptions = new Options({
|
||||
maximumSelectionLength: 1
|
||||
});
|
||||
var data = new MaximumData(null, maxOfOneOptions);
|
||||
var data = new MaximumSelectionData(null, maxOfOneOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -135,7 +138,7 @@ test('triggers when >= 1 selection' , function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, maxOfOneOptions);
|
||||
data = new MaximumSelectionData(null, maxOfOneOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(true, 'The event should be triggered.');
|
||||
@ -155,7 +158,7 @@ test('triggers when >= 2 selections' , function (assert) {
|
||||
var maxOfTwoOptions = new Options({
|
||||
maximumSelectionLength: 2
|
||||
});
|
||||
var data = new MaximumData(null, maxOfTwoOptions);
|
||||
var data = new MaximumSelectionData(null, maxOfTwoOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -167,7 +170,7 @@ test('triggers when >= 2 selections' , function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, maxOfTwoOptions);
|
||||
data = new MaximumSelectionData(null, maxOfTwoOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(false, 'No events should be triggered');
|
||||
@ -181,7 +184,7 @@ test('triggers when >= 2 selections' , function (assert) {
|
||||
|
||||
assert.ok(data.called);
|
||||
|
||||
data = new MaximumData(null, maxOfTwoOptions);
|
||||
data = new MaximumSelectionData(null, maxOfTwoOptions);
|
||||
|
||||
data.trigger = function () {
|
||||
assert.ok(true, 'The event should be triggered.');
|
||||
|
@ -1,20 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="maximumSelectionLength-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="minimumInputLength-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
24
tests/dropdown.html
Normal file
24
tests/dropdown.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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>
|
||||
</div>
|
||||
|
||||
<script src="vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../vendor/jquery-2.1.0.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="dropdown/selectOnClose-tests.js" type="text/javascript"></script>
|
||||
<script src="dropdown/stopPropagation-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="selectOnClose-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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>
|
||||
</div>
|
||||
|
||||
<script src="../vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="stopPropagation-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
27
tests/options.html
Normal file
27
tests/options.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../dist/css/select2.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<style type="text/css">
|
||||
.css-set-width {
|
||||
width: 500px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<script src="vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../vendor/jquery-2.1.0.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="options/data-tests.js" type="text/javascript"></script>
|
||||
<script src="options/deprecated-tests.js" type="text/javascript"></script>
|
||||
<script src="options/width-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="data-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="deprecated-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../dist/css/select2.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<style type="text/css">
|
||||
.css-set-width {
|
||||
width: 500px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<script src="../vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="width-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
37
tests/selection.html
Normal file
37
tests/selection.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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">
|
||||
<select class="single">
|
||||
<option>One</option>
|
||||
</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>
|
||||
</div>
|
||||
|
||||
<script src="vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../vendor/jquery-2.1.0.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="selection/allowClear-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/single-tests.js" type="text/javascript"></script>
|
||||
<script src="selection/stopPropagation-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -9,12 +9,12 @@ var $ = require('jquery');
|
||||
var Options = require('select2/options');
|
||||
var Utils = require('select2/utils');
|
||||
|
||||
var SinglePlaceholder = Utils.Decorate(
|
||||
var AllowClearPlaceholder = Utils.Decorate(
|
||||
Utils.Decorate(SingleSelection, Placeholder),
|
||||
AllowClear
|
||||
);
|
||||
|
||||
var options = new Options({
|
||||
var allowClearOptions = new Options({
|
||||
placeholder: {
|
||||
id: 'placeholder',
|
||||
text: 'This is the placeholder'
|
||||
@ -23,9 +23,9 @@ var options = new Options({
|
||||
});
|
||||
|
||||
test('clear is not displayed for single placeholder', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
$('#qunit-fixture .single'),
|
||||
options
|
||||
var selection = new AllowClearPlaceholder(
|
||||
$('#qunit-fixture .single-with-placeholder'),
|
||||
allowClearOptions
|
||||
);
|
||||
|
||||
var $selection = selection.render();
|
||||
@ -42,9 +42,9 @@ test('clear is not displayed for single placeholder', function (assert) {
|
||||
});
|
||||
|
||||
test('clear is not displayed for multiple placeholder', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
$('#qunit-fixture .single'),
|
||||
options
|
||||
var selection = new AllowClearPlaceholder(
|
||||
$('#qunit-fixture .single-with-placeholder'),
|
||||
allowClearOptions
|
||||
);
|
||||
|
||||
var $selection = selection.render();
|
||||
@ -60,9 +60,9 @@ test('clear is not displayed for multiple placeholder', function (assert) {
|
||||
|
||||
|
||||
test('clear is displayed for placeholder', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
$('#qunit-fixture .single'),
|
||||
options
|
||||
var selection = new AllowClearPlaceholder(
|
||||
$('#qunit-fixture .single-with-placeholder'),
|
||||
allowClearOptions
|
||||
);
|
||||
|
||||
var $selection = selection.render();
|
||||
@ -80,11 +80,11 @@ test('clear is displayed for placeholder', function (assert) {
|
||||
});
|
||||
|
||||
test('clicking clear will set the placeholder value', function (assert) {
|
||||
var $element = $('#qunit-fixture .single');
|
||||
var $element = $('#qunit-fixture .single-with-placeholder');
|
||||
|
||||
var selection = new SinglePlaceholder(
|
||||
var selection = new AllowClearPlaceholder(
|
||||
$element,
|
||||
options
|
||||
allowClearOptions
|
||||
);
|
||||
var container = new MockContainer();
|
||||
|
||||
@ -111,11 +111,11 @@ test('clicking clear will set the placeholder value', function (assert) {
|
||||
test('clicking clear will trigger the unselect event', function (assert) {
|
||||
expect(3);
|
||||
|
||||
var $element = $('#qunit-fixture .single');
|
||||
var $element = $('#qunit-fixture .single-with-placeholder');
|
||||
|
||||
var selection = new SinglePlaceholder(
|
||||
var selection = new AllowClearPlaceholder(
|
||||
$element,
|
||||
options
|
||||
allowClearOptions
|
||||
);
|
||||
var container = new MockContainer();
|
||||
|
||||
@ -154,11 +154,11 @@ test('clicking clear will trigger the unselect event', function (assert) {
|
||||
|
||||
|
||||
test('preventing the unselect event cancels the clearing', function (assert) {
|
||||
var $element = $('#qunit-fixture .single');
|
||||
var $element = $('#qunit-fixture .single-with-placeholder');
|
||||
|
||||
var selection = new SinglePlaceholder(
|
||||
var selection = new AllowClearPlaceholder(
|
||||
$element,
|
||||
options
|
||||
allowClearOptions
|
||||
);
|
||||
var container = new MockContainer();
|
||||
|
||||
@ -187,11 +187,11 @@ test('preventing the unselect event cancels the clearing', function (assert) {
|
||||
});
|
||||
|
||||
test('clear does not work when disabled', function (assert) {
|
||||
var $element = $('#qunit-fixture .single');
|
||||
var $element = $('#qunit-fixture .single-with-placeholder');
|
||||
|
||||
var selection = new SinglePlaceholder(
|
||||
var selection = new AllowClearPlaceholder(
|
||||
$element,
|
||||
options
|
||||
allowClearOptions
|
||||
);
|
||||
var container = new MockContainer();
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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">
|
||||
<select class="single">
|
||||
<option>placeholder</option>
|
||||
<option>One</option>
|
||||
</select>
|
||||
|
||||
<select class="multiple" multiple="multiple">
|
||||
<option>One</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<script src="../vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="allowClear-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,24 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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">
|
||||
<select class="multiple" multiple="multiple">
|
||||
<option>One</option>
|
||||
<option>Two</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<script src="../vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="multiple-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -9,7 +9,7 @@ var Utils = require('select2/utils');
|
||||
|
||||
var SinglePlaceholder = Utils.Decorate(SingleSelection, Placeholder);
|
||||
|
||||
var options = new Options({
|
||||
var placeholderOptions = new Options({
|
||||
placeholder: {
|
||||
id: 'placeholder',
|
||||
text: 'This is the placeholder'
|
||||
@ -19,7 +19,7 @@ var options = new Options({
|
||||
test('normalizing placeholder ignores objects', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
$('#qunit-fixture .single'),
|
||||
options
|
||||
placeholderOptions
|
||||
);
|
||||
|
||||
var original = {
|
||||
@ -35,7 +35,7 @@ test('normalizing placeholder ignores objects', function (assert) {
|
||||
test('normalizing placeholder gives object for string', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
$('#qunit-fixture .single'),
|
||||
options
|
||||
placeholderOptions
|
||||
);
|
||||
|
||||
var normalized = selection.normalizePlaceholder('placeholder');
|
||||
@ -48,7 +48,7 @@ test('normalizing placeholder gives object for string', function (assert) {
|
||||
test('text is shown for placeholder option on single', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
$('#qunit-fixture .single'),
|
||||
options
|
||||
placeholderOptions
|
||||
);
|
||||
|
||||
var $selection = selection.render();
|
||||
@ -63,7 +63,7 @@ test('text is shown for placeholder option on single', function (assert) {
|
||||
test('placeholder is shown when no options are selected', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
$('#qunit-fixture .multiple'),
|
||||
options
|
||||
placeholderOptions
|
||||
);
|
||||
|
||||
var $selection = selection.render();
|
||||
|
@ -1,27 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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">
|
||||
<select class="single">
|
||||
<option>One</option>
|
||||
</select>
|
||||
|
||||
<select class="multiple" multiple="multiple">
|
||||
<option>One</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<script src="../vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="placeholder-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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">
|
||||
<select class="single">
|
||||
<option>One</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<script src="../vendor/qunit-1.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="single-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
20
tests/utils.html
Normal file
20
tests/utils.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../vendor/jquery-2.1.0.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="utils/decorator-tests.js" type="text/javascript"></script>
|
||||
<script src="utils/escapeMarkup-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="decorator-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../vendor/qunit-1.14.0.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.14.0.js" type="text/javascript"></script>
|
||||
<script src="../../vendor/jquery-2.1.0.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="escapeMarkup-tests.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user