-
-
-
-
-
-
-
-
-
-
diff --git a/tests/data/maximumInputLength-tests.js b/tests/data/maximumInputLength-tests.js
index a3f5a28b..e8557139 100644
--- a/tests/data/maximumInputLength-tests.js
+++ b/tests/data/maximumInputLength-tests.js
@@ -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');
diff --git a/tests/data/maximumInputLength.html b/tests/data/maximumInputLength.html
deleted file mode 100644
index 94787088..00000000
--- a/tests/data/maximumInputLength.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/data/maximumSelectionLength-tests.js b/tests/data/maximumSelectionLength-tests.js
index dccaf08f..89943b38 100644
--- a/tests/data/maximumSelectionLength-tests.js
+++ b/tests/data/maximumSelectionLength-tests.js
@@ -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.');
@@ -196,4 +199,4 @@ test('triggers when >= 2 selections' , function (assert) {
assert.ok(!data.called);
-});
\ No newline at end of file
+});
diff --git a/tests/data/maximumSelectionLength.html b/tests/data/maximumSelectionLength.html
deleted file mode 100644
index 9501868a..00000000
--- a/tests/data/maximumSelectionLength.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/selection/allowClear-tests.js b/tests/selection/allowClear-tests.js
index c46b0fb2..e7f4fd86 100644
--- a/tests/selection/allowClear-tests.js
+++ b/tests/selection/allowClear-tests.js
@@ -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();
diff --git a/tests/selection/allowClear.html b/tests/selection/allowClear.html
deleted file mode 100644
index 48135d7b..00000000
--- a/tests/selection/allowClear.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-