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

Switch to calling test and module off of QUnit

This commit is contained in:
Kevin Brown 2019-08-07 21:16:45 -04:00
parent d54560f21e
commit 0241a48a8c
41 changed files with 319 additions and 313 deletions

View File

@ -10,10 +10,8 @@
"define": false,
"document": false,
"MockContainer": false,
"module": false,
"QUnit": false,
"require": false,
"test": false,
"window": false
},
"indent": 2,

View File

@ -1,4 +1,4 @@
module('Accessibility - All');
QUnit.module('Accessibility - All');
var BaseSelection = require('select2/selection/base');
var SingleSelection = require('select2/selection/single');
@ -9,7 +9,7 @@ var $ = require('jquery');
var Options = require('select2/options');
var options = new Options({});
test('title is carried over from original element', function (assert) {
QUnit.test('title is carried over from original element', function (assert) {
var $select = $('#qunit-fixture .single');
var selection = new BaseSelection($select, options);
@ -22,32 +22,35 @@ test('title is carried over from original element', function (assert) {
);
});
test('aria-expanded reflects the state of the container', function (assert) {
var $select = $('#qunit-fixture .single');
QUnit.test(
'aria-expanded reflects the state of the container',
function (assert) {
var $select = $('#qunit-fixture .single');
var selection = new BaseSelection($select, options);
var $selection = selection.render();
var selection = new BaseSelection($select, options);
var $selection = selection.render();
var container = new MockContainer();
var container = new MockContainer();
selection.bind(container, $('<span></span>'));
selection.bind(container, $('<span></span>'));
assert.equal(
$selection.attr('aria-expanded'),
'false',
'The container should not be expanded when it is closed'
);
assert.equal(
$selection.attr('aria-expanded'),
'false',
'The container should not be expanded when it is closed'
);
container.trigger('open');
container.trigger('open');
assert.equal(
$selection.attr('aria-expanded'),
'true',
'The container should be expanded when it is opened'
);
});
assert.equal(
$selection.attr('aria-expanded'),
'true',
'The container should be expanded when it is opened'
);
}
);
test('static aria attributes are present', function (assert) {
QUnit.test('static aria attributes are present', function (assert) {
var $select = $('#qunit-fixture .single');
var selection = new BaseSelection($select, options);
@ -66,7 +69,7 @@ test('static aria attributes are present', function (assert) {
);
});
test('the container should be in the tab order', function (assert) {
QUnit.test('the container should be in the tab order', function (assert) {
var $select = $('#qunit-fixture .single');
var selection = new BaseSelection($select, options);
@ -98,7 +101,7 @@ test('the container should be in the tab order', function (assert) {
);
});
test('a custom tabindex is copied', function (assert) {
QUnit.test('a custom tabindex is copied', function (assert) {
var $select = $('#qunit-fixture .single');
$select.attr('tabindex', '999');
@ -131,7 +134,7 @@ test('a custom tabindex is copied', function (assert) {
);
});
test('aria-disabled should reflected disabled state', function (assert) {
QUnit.test('aria-disabled should reflected disabled state', function (assert) {
var $select = $('#qunit-fixture .single');
var selection = new BaseSelection($select, options);
@ -163,24 +166,27 @@ test('aria-disabled should reflected disabled state', function (assert) {
);
});
module('Accessibility - Single');
QUnit.module('Accessibility - Single');
test('aria-labelledby should match the rendered container', function (assert) {
var $select = $('#qunit-fixture .single');
QUnit.test(
'aria-labelledby should match the rendered container',
function (assert) {
var $select = $('#qunit-fixture .single');
var selection = new SingleSelection($select, options);
var $selection = selection.render();
var selection = new SingleSelection($select, options);
var $selection = selection.render();
var container = new MockContainer();
selection.bind(container, $('<span></span>'));
var container = new MockContainer();
selection.bind(container, $('<span></span>'));
var $rendered = $selection.find('.select2-selection__rendered');
var $rendered = $selection.find('.select2-selection__rendered');
assert.equal(
$selection.attr('aria-labelledby'),
$rendered.attr('id'),
'The rendered selection should label the container'
);
});
assert.equal(
$selection.attr('aria-labelledby'),
$rendered.attr('id'),
'The rendered selection should label the container'
);
}
);
module('Accessibility - Multiple');
QUnit.module('Accessibility - Multiple');

View File

@ -1,4 +1,4 @@
module('Data adapters - Array');
QUnit.module('Data adapters - Array');
var ArrayData = require('select2/data/array');
var $ = require('jquery');
@ -66,7 +66,7 @@ var nestedOptions = new Options({
]
});
test('current gets default for single', function (assert) {
QUnit.test('current gets default for single', function (assert) {
var $select = $('#qunit-fixture .single-empty');
var data = new ArrayData($select, arrayOptions);
@ -91,7 +91,7 @@ test('current gets default for single', function (assert) {
});
});
test('current gets default for multiple', function (assert) {
QUnit.test('current gets default for multiple', function (assert) {
var $select = $('#qunit-fixture .multiple');
var data = new ArrayData($select, arrayOptions);
@ -108,7 +108,7 @@ test('current gets default for multiple', function (assert) {
});
});
test('current works with existing selections', function (assert) {
QUnit.test('current works with existing selections', function (assert) {
var $select = $('#qunit-fixture .multiple');
var data = new ArrayData($select, arrayOptions);
@ -141,7 +141,7 @@ test('current works with existing selections', function (assert) {
});
});
test('current works with selected data', function (assert) {
QUnit.test('current works with selected data', function (assert) {
var $select = $('#qunit-fixture .single-empty');
var data = new ArrayData($select, arrayOptions);
@ -177,7 +177,7 @@ test('current works with selected data', function (assert) {
});
});
test('select works for single', function (assert) {
QUnit.test('select works for single', function (assert) {
var $select = $('#qunit-fixture .single-empty');
var data = new ArrayData($select, arrayOptions);
@ -203,7 +203,7 @@ test('select works for single', function (assert) {
);
});
test('multiple sets the value', function (assert) {
QUnit.test('multiple sets the value', function (assert) {
var $select = $('#qunit-fixture .multiple');
var data = new ArrayData($select, arrayOptions);
@ -224,7 +224,7 @@ test('multiple sets the value', function (assert) {
assert.deepEqual($select.val(), ['default']);
});
test('multiple adds to the old value', function (assert) {
QUnit.test('multiple adds to the old value', function (assert) {
var $select = $('#qunit-fixture .multiple');
var data = new ArrayData($select, arrayOptions);
@ -244,7 +244,7 @@ test('multiple adds to the old value', function (assert) {
assert.deepEqual($select.val(), ['One', 'default']);
});
test('option tags are automatically generated', function (assert) {
QUnit.test('option tags are automatically generated', function (assert) {
var $select = $('#qunit-fixture .single-empty');
var data = new ArrayData($select, arrayOptions);
@ -259,7 +259,7 @@ test('option tags are automatically generated', function (assert) {
);
});
test('automatically generated option tags have a result id', function (assert) {
QUnit.test('automatically generated option tags have a result id', function (assert) {
var $select = $('#qunit-fixture .single-empty');
var data = new ArrayData($select, arrayOptions);
@ -277,7 +277,7 @@ test('automatically generated option tags have a result id', function (assert) {
);
});
test('option tags can receive new data', function(assert) {
QUnit.test('option tags can receive new data', function(assert) {
var $select = $('#qunit-fixture .single');
var data = new ArrayData($select, extraOptions);
@ -310,7 +310,7 @@ test('option tags can receive new data', function(assert) {
);
});
test('optgroup tags can also be generated', function (assert) {
QUnit.test('optgroup tags can also be generated', function (assert) {
var $select = $('#qunit-fixture .single-empty');
var data = new ArrayData($select, nestedOptions);
@ -331,7 +331,7 @@ test('optgroup tags can also be generated', function (assert) {
);
});
test('optgroup tags have the right properties', function (assert) {
QUnit.test('optgroup tags have the right properties', function (assert) {
var $select = $('#qunit-fixture .single-empty');
var data = new ArrayData($select, nestedOptions);
@ -354,7 +354,7 @@ test('optgroup tags have the right properties', function (assert) {
);
});
test('existing selections are respected on initialization', function (assert) {
QUnit.test('existing selections are respected on initialization', function (assert) {
var $select = $(
'<select>' +
'<option>First</option>' +

View File

@ -1,4 +1,4 @@
module('Data adapters - Base');
QUnit.module('Data adapters - Base');
var BaseData = require('select2/data/base');
var $ = require('jquery');
@ -6,7 +6,7 @@ var Options = require('select2/options');
var options = new Options({});
test('current is required', function (assert) {
QUnit.test('current is required', function (assert) {
var data = new BaseData($('#qunit-fixture select'), options);
assert.throws(
@ -17,7 +17,7 @@ test('current is required', function (assert) {
);
});
test('query is required', function (assert) {
QUnit.test('query is required', function (assert) {
var data = new BaseData($('#qunit-fixture select'), options);
assert.throws(

View File

@ -1,4 +1,4 @@
module('Data adapters - <input> compatibility');
QUnit.module('Data adapters - <input> compatibility');
var $ = require('jquery');
@ -10,7 +10,7 @@ var InputData = require('select2/compat/inputData');
var InputAdapter = Utils.Decorate(ArrayData, InputData);
test('test that options can be selected', function (assert) {
QUnit.test('test that options can be selected', function (assert) {
var options = new Options({
data: [
{
@ -37,7 +37,7 @@ test('test that options can be selected', function (assert) {
);
});
test('unselect the single selected option clears the value', function (assert) {
QUnit.test('unselect the single selected option clears the value', function (assert) {
var options = new Options({
data: [
{
@ -65,7 +65,7 @@ test('unselect the single selected option clears the value', function (assert) {
);
});
test('options can be unselected individually', function (assert) {
QUnit.test('options can be unselected individually', function (assert) {
var options = new Options({
data: [
{
@ -101,7 +101,7 @@ test('options can be unselected individually', function (assert) {
);
});
test('default values can be set', function (assert) {
QUnit.test('default values can be set', function (assert) {
assert.expect(4);
var options = new Options({
@ -139,7 +139,7 @@ test('default values can be set', function (assert) {
);
});
test('no default value', function (assert) {
QUnit.test('no default value', function (assert) {
assert.expect(2);
var options = new Options({

View File

@ -1,4 +1,4 @@
module('Data adapters - Maximum input length');
QUnit.module('Data adapters - Maximum input length');
var MaximumInputLength = require('select2/data/maximumInputLength');
var $ = require('jquery');
@ -15,7 +15,7 @@ MaximumInputStub.prototype.query = function (params, callback) {
var MaximumInputData = Utils.Decorate(MaximumInputStub, MaximumInputLength);
test('0 never displays the notice', function (assert) {
QUnit.test('0 never displays the notice', function (assert) {
var zeroOptions = new Options({
maximumInputLength: 0
});
@ -41,7 +41,7 @@ test('0 never displays the notice', function (assert) {
assert.ok(data.called);
});
test('< 0 never displays the notice', function (assert) {
QUnit.test('< 0 never displays the notice', function (assert) {
var negativeOptions = new Options({
maximumInputLength: -1
});
@ -67,7 +67,7 @@ test('< 0 never displays the notice', function (assert) {
assert.ok(data.called);
});
test('triggers when input is too long', function (assert) {
QUnit.test('triggers when input is too long', function (assert) {
var options = new Options({
maximumInputLength: 1
});
@ -85,7 +85,7 @@ test('triggers when input is too long', function (assert) {
assert.ok(!data.called, 'The adapter should not be called');
});
test('does not trigger when equal', function (assert) {
QUnit.test('does not trigger when equal', function (assert) {
var options = new Options({
maximumInputLength: 10
});
@ -103,7 +103,7 @@ test('does not trigger when equal', function (assert) {
assert.ok(data.called);
});
test('does not trigger when less', function (assert) {
QUnit.test('does not trigger when less', function (assert) {
var options = new Options({
maximumInputLength: 10
});
@ -121,7 +121,7 @@ test('does not trigger when less', function (assert) {
assert.ok(data.called);
});
test('works with null term', function (assert) {
QUnit.test('works with null term', function (assert) {
var options = new Options({
maximumInputLength: 1
});

View File

@ -1,4 +1,4 @@
module('Data adapters - Maximum selection length');
QUnit.module('Data adapters - Maximum selection length');
var SelectData = require('select2/data/select');
var MaximumSelectionLength = require('select2/data/maximumSelectionLength');
@ -9,7 +9,7 @@ var Utils = require('select2/utils');
var MaximumSelectionData = Utils.Decorate(SelectData, MaximumSelectionLength);
test('0 never displays the notice', function (assert) {
QUnit.test('0 never displays the notice', function (assert) {
assert.expect(3);
var $select = $('#qunit-fixture .multiple');
@ -50,7 +50,7 @@ test('0 never displays the notice', function (assert) {
});
});
test('< 0 never displays the notice', function (assert) {
QUnit.test('< 0 never displays the notice', function (assert) {
assert.expect(3);
var $select = $('#qunit-fixture .multiple');
@ -91,7 +91,7 @@ test('< 0 never displays the notice', function (assert) {
});
});
test('triggers when >= 1 selection' , function (assert) {
QUnit.test('triggers when >= 1 selection' , function (assert) {
assert.expect(2);
var $select = $('#qunit-fixture .multiple');
@ -126,7 +126,7 @@ test('triggers when >= 1 selection' , function (assert) {
});
});
test('triggers after selection' , function (assert) {
QUnit.test('triggers after selection' , function (assert) {
assert.expect(1);
var $select = $('#qunit-fixture .multiple');

View File

@ -1,4 +1,4 @@
module('Data adapters - Minimum input length');
QUnit.module('Data adapters - Minimum input length');
var MinimumInputLength = require('select2/data/minimumInputLength');
var $ = require('jquery');
@ -15,7 +15,7 @@ StubData.prototype.query = function (params, callback) {
var MinimumData = Utils.Decorate(StubData, MinimumInputLength);
test('0 never displays the notice', function (assert) {
QUnit.test('0 never displays the notice', function (assert) {
var zeroOptions = new Options({
minimumInputLength: 0
});
@ -41,7 +41,7 @@ test('0 never displays the notice', function (assert) {
assert.ok(data.called);
});
test('< 0 never displays the notice', function (assert) {
QUnit.test('< 0 never displays the notice', function (assert) {
var negativeOptions = new Options({
minimumInputLength: -1
});
@ -67,7 +67,7 @@ test('< 0 never displays the notice', function (assert) {
assert.ok(data.called);
});
test('triggers when input is not long enough', function (assert) {
QUnit.test('triggers when input is not long enough', function (assert) {
var options = new Options({
minimumInputLength: 10
});
@ -85,7 +85,7 @@ test('triggers when input is not long enough', function (assert) {
assert.ok(!data.called);
});
test('does not trigger when equal', function (assert) {
QUnit.test('does not trigger when equal', function (assert) {
var options = new Options({
minimumInputLength: 10
});
@ -103,7 +103,7 @@ test('does not trigger when equal', function (assert) {
assert.ok(data.called);
});
test('does not trigger when greater', function (assert) {
QUnit.test('does not trigger when greater', function (assert) {
var options = new Options({
minimumInputLength: 10
});
@ -121,7 +121,7 @@ test('does not trigger when greater', function (assert) {
assert.ok(data.called);
});
test('works with null term', function (assert) {
QUnit.test('works with null term', function (assert) {
var options = new Options({
minimumInputLength: 1
});

View File

@ -1,11 +1,11 @@
module('Data adapters - Select - current');
QUnit.module('Data adapters - Select - current');
var SelectData = require('select2/data/select');
var $ = require('jquery');
var Options = require('select2/options');
var selectOptions = new Options({});
test('current gets default for single', function (assert) {
QUnit.test('current gets default for single', function (assert) {
var $select = $('#qunit-fixture .single');
var data = new SelectData($select, selectOptions);
@ -33,7 +33,7 @@ test('current gets default for single', function (assert) {
});
});
test('current gets default for multiple', function (assert) {
QUnit.test('current gets default for multiple', function (assert) {
var $select = $('#qunit-fixture .multiple');
var data = new SelectData($select, selectOptions);
@ -47,7 +47,7 @@ test('current gets default for multiple', function (assert) {
});
});
test('current gets options with explicit value', function (assert) {
QUnit.test('current gets options with explicit value', function (assert) {
var $select = $('#qunit-fixture .single');
var $option = $('<option value="1">One</option>');
@ -80,7 +80,7 @@ test('current gets options with explicit value', function (assert) {
});
});
test('current gets options with implicit value', function (assert) {
QUnit.test('current gets options with implicit value', function (assert) {
var $select = $('#qunit-fixture .single');
var data = new SelectData($select, selectOptions);
@ -110,7 +110,7 @@ test('current gets options with implicit value', function (assert) {
});
});
test('select works for single', function (assert) {
QUnit.test('select works for single', function (assert) {
var $select = $('#qunit-fixture .single-with-placeholder');
var data = new SelectData($select, selectOptions);
@ -125,7 +125,7 @@ test('select works for single', function (assert) {
assert.equal($select.val(), 'One');
});
test('multiple sets the value', function (assert) {
QUnit.test('multiple sets the value', function (assert) {
var $select = $('#qunit-fixture .multiple');
var data = new SelectData($select, selectOptions);
@ -143,7 +143,7 @@ test('multiple sets the value', function (assert) {
assert.deepEqual($select.val(), ['Two']);
});
test('multiple adds to the old value', function (assert) {
QUnit.test('multiple adds to the old value', function (assert) {
var $select = $('#qunit-fixture .multiple');
var data = new SelectData($select, selectOptions);
@ -160,7 +160,7 @@ test('multiple adds to the old value', function (assert) {
assert.deepEqual($select.val(), ['One', 'Two']);
});
test('duplicates - single - same id on select triggers change',
QUnit.test('duplicates - single - same id on select triggers change',
function (assert) {
var $select = $('#qunit-fixture .duplicates');
@ -198,7 +198,7 @@ test('duplicates - single - same id on select triggers change',
);
});
test('duplicates - single - different id on select triggers change',
QUnit.test('duplicates - single - different id on select triggers change',
function (assert) {
var $select = $('#qunit-fixture .duplicates');
@ -236,7 +236,7 @@ test('duplicates - single - different id on select triggers change',
);
});
test('duplicates - multiple - same id on select triggers change',
QUnit.test('duplicates - multiple - same id on select triggers change',
function (assert) {
var $select = $('#qunit-fixture .duplicates-multi');
@ -274,7 +274,7 @@ function (assert) {
);
});
test('duplicates - multiple - different id on select triggers change',
QUnit.test('duplicates - multiple - different id on select triggers change',
function (assert) {
var $select = $('#qunit-fixture .duplicates-multi');
@ -312,9 +312,9 @@ function (assert) {
);
});
module('Data adapter - Select - query');
QUnit.module('Data adapter - Select - query');
test('all options are returned with no term', function (assert) {
QUnit.test('all options are returned with no term', function (assert) {
var $select = $('#qunit-fixture .single');
var data = new SelectData($select, selectOptions);
@ -328,7 +328,7 @@ test('all options are returned with no term', function (assert) {
});
});
test('the matcher checks the text', function (assert) {
QUnit.test('the matcher checks the text', function (assert) {
var $select = $('#qunit-fixture .single');
var data = new SelectData($select, selectOptions);
@ -344,7 +344,7 @@ test('the matcher checks the text', function (assert) {
});
});
test('the matcher ignores case', function (assert) {
QUnit.test('the matcher ignores case', function (assert) {
var $select = $('#qunit-fixture .single');
var data = new SelectData($select, selectOptions);
@ -360,7 +360,7 @@ test('the matcher ignores case', function (assert) {
});
});
test('no options may be returned with no matches', function (assert) {
QUnit.test('no options may be returned with no matches', function (assert) {
var $select = $('#qunit-fixture .single');
var data = new SelectData($select, selectOptions);
@ -376,7 +376,7 @@ test('no options may be returned with no matches', function (assert) {
});
});
test('optgroup tags are marked with children', function (assert) {
QUnit.test('optgroup tags are marked with children', function (assert) {
var $select = $('#qunit-fixture .groups');
var data = new SelectData($select, selectOptions);
@ -389,7 +389,7 @@ test('optgroup tags are marked with children', function (assert) {
});
});
test('empty optgroups are still shown when queried', function (assert) {
QUnit.test('empty optgroups are still shown when queried', function (assert) {
var $select = $('#qunit-fixture .groups');
var data = new SelectData($select, selectOptions);
@ -417,7 +417,7 @@ test('empty optgroups are still shown when queried', function (assert) {
});
});
test('multiple options with the same value are returned', function (assert) {
QUnit.test('multiple options with the same value are returned', function (assert) {
var $select = $('#qunit-fixture .duplicates');
var data = new SelectData($select, selectOptions);
@ -446,7 +446,7 @@ test('multiple options with the same value are returned', function (assert) {
});
});
test('data objects use the text of the option', function (assert) {
QUnit.test('data objects use the text of the option', function (assert) {
var $select = $('#qunit-fixture .duplicates');
var data = new SelectData($select, selectOptions);
@ -459,7 +459,7 @@ test('data objects use the text of the option', function (assert) {
assert.equal(item.text, '&');
});
test('select option construction accepts id=0 (zero) value', function (assert) {
QUnit.test('select option construction accepts id=0 (zero) value', function (assert) {
var $select = $('#qunit-fixture .single');
var selectOptions = [{ id: 0, text: 'Zero Value'}];
@ -475,7 +475,7 @@ test('select option construction accepts id=0 (zero) value', function (assert) {
);
});
test('select option construction accepts id="" (empty string) value',
QUnit.test('select option construction accepts id="" (empty string) value',
function (assert) {
var $select = $('#qunit-fixture .single');
@ -491,7 +491,7 @@ test('select option construction accepts id="" (empty string) value',
);
});
test('user-defined types are normalized properly', function (assert) {
QUnit.test('user-defined types are normalized properly', function (assert) {
var $select = $('#qunit-fixture .user-defined'),
UserDefinedType = function (id, text) {

View File

@ -1,4 +1,4 @@
module('Data adapters - Tags');
QUnit.module('Data adapters - Tags');
var SelectData = require('select2/data/select');
var Tags = require('select2/data/tags');
@ -12,7 +12,7 @@ var options = new Options({
tags: true
});
test('does not trigger on blank or null terms', function (assert) {
QUnit.test('does not trigger on blank or null terms', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -38,7 +38,7 @@ test('does not trigger on blank or null terms', function (assert) {
});
});
test('white space is trimmed by default', function (assert) {
QUnit.test('white space is trimmed by default', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -64,7 +64,7 @@ test('white space is trimmed by default', function (assert) {
});
});
test('does not create option if text is same but lowercase', function (assert) {
QUnit.test('does not create option if text is same but lowercase', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -79,7 +79,7 @@ test('does not create option if text is same but lowercase', function (assert) {
});
});
test('does not trigger for additional pages', function (assert) {
QUnit.test('does not trigger for additional pages', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -94,7 +94,7 @@ test('does not trigger for additional pages', function (assert) {
});
});
test('creates tag at beginning', function (assert) {
QUnit.test('creates tag at beginning', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -109,7 +109,7 @@ test('creates tag at beginning', function (assert) {
});
});
test('tags can be the only result', function (assert) {
QUnit.test('tags can be the only result', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -124,7 +124,7 @@ test('tags can be the only result', function (assert) {
});
});
test('tags are injected as options', function (assert) {
QUnit.test('tags are injected as options', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -143,7 +143,7 @@ test('tags are injected as options', function (assert) {
});
});
test('old tags are removed automatically', function (assert) {
QUnit.test('old tags are removed automatically', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.query({
@ -172,7 +172,7 @@ test('old tags are removed automatically', function (assert) {
});
});
test('insertTag controls the tag location', function (assert) {
QUnit.test('insertTag controls the tag location', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.insertTag = function (data, tag) {
@ -191,7 +191,7 @@ test('insertTag controls the tag location', function (assert) {
});
});
test('insertTag can be controlled through the options', function (assert) {
QUnit.test('insertTag can be controlled through the options', function (assert) {
var options = new Options({
insertTag: function (data, tag) {
data.push(tag);
@ -211,7 +211,7 @@ test('insertTag can be controlled through the options', function (assert) {
});
});
test('createTag controls the tag object', function (assert) {
QUnit.test('createTag controls the tag object', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.createTag = function (params) {
@ -233,7 +233,7 @@ test('createTag controls the tag object', function (assert) {
});
});
test('createTag returns null for no tag', function (assert) {
QUnit.test('createTag returns null for no tag', function (assert) {
var data = new SelectTags($('#qunit-fixture .single'), options);
data.createTag = function (params) {
@ -247,7 +247,7 @@ test('createTag returns null for no tag', function (assert) {
});
});
test('the createTag options customizes the function', function (assert) {
QUnit.test('the createTag options customizes the function', function (assert) {
var data = new SelectTags(
$('#qunit-fixture .single'),
new Options({

View File

@ -1,6 +1,6 @@
module('Data adaptor - Tokenizer');
QUnit.module('Data adaptor - Tokenizer');
test('triggers the select event', function (assert) {
QUnit.test('triggers the select event', function (assert) {
assert.expect(2);
var SelectData = require('select2/data/select');
@ -42,7 +42,7 @@ test('triggers the select event', function (assert) {
});
});
test('createTag can return null', function (assert) {
QUnit.test('createTag can return null', function (assert) {
assert.expect(3);
var SelectData = require('select2/data/select');
@ -91,7 +91,7 @@ test('createTag can return null', function (assert) {
});
});
test('createTag returning null does not cut the term', function (assert) {
QUnit.test('createTag returning null does not cut the term', function (assert) {
assert.expect(4);
var SelectData = require('select2/data/select');
@ -170,7 +170,7 @@ test('createTag returning null does not cut the term', function (assert) {
});
});
test('works with multiple tokens given', function (assert) {
QUnit.test('works with multiple tokens given', function (assert) {
assert.expect(4);
var SelectData = require('select2/data/select');

View File

@ -1,4 +1,4 @@
module('Dropdown - dropdownCssClass compatibility');
QUnit.module('Dropdown - dropdownCssClass compatibility');
var $ = require('jquery');
var Utils = require('select2/utils');
@ -10,7 +10,7 @@ var DropdownCSS = Utils.Decorate(
require('select2/compat/dropdownCss')
);
test('all classes will be copied if :all: is used', function (assert) {
QUnit.test('all classes will be copied if :all: is used', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
dropdownCssClass: ':all:'
@ -25,7 +25,7 @@ test('all classes will be copied if :all: is used', function (assert) {
assert.ok(!$dropdown.hasClass(':all:'));
});
test(':all: can be used with other classes', function (assert) {
QUnit.test(':all: can be used with other classes', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
dropdownCssClass: ':all: other'
@ -41,7 +41,7 @@ test(':all: can be used with other classes', function (assert) {
assert.ok(!$dropdown.hasClass(':all:'));
});
test('classes can be passed in as a string', function (assert) {
QUnit.test('classes can be passed in as a string', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
dropdownCssClass: 'other'
@ -53,7 +53,7 @@ test('classes can be passed in as a string', function (assert) {
assert.ok($dropdown.hasClass('other'));
});
test('a function can be used based on the element', function (assert){
QUnit.test('a function can be used based on the element', function (assert){
var $element = $('<select class="test"></select>');
var options = new Options({
dropdownCssClass: function ($element) {
@ -68,7 +68,7 @@ test('a function can be used based on the element', function (assert){
assert.ok(!$dropdown.hasClass('test'));
});
test(':all: works around custom adapters', function (assert) {
QUnit.test(':all: works around custom adapters', function (assert) {
var $element = $('<select class="test"></select>');
var options = new Options({
dropdownCssClass: ':all: something',
@ -86,9 +86,9 @@ test(':all: works around custom adapters', function (assert) {
assert.ok($dropdown.hasClass('test-modified'));
});
module('Dropdown - adaptDropdownCss compatibility');
QUnit.module('Dropdown - adaptDropdownCss compatibility');
test('only return when adapted', function (assert) {
QUnit.test('only return when adapted', function (assert) {
var $element = $('<select class="original"></select>');
var options = new Options({
adaptDropdownCssClass: function (clazz) {

View File

@ -1,6 +1,6 @@
module('Dropdown - attachBody - positioning');
QUnit.module('Dropdown - attachBody - positioning');
test('appends to the dropdown parent', function (assert) {
QUnit.test('appends to the dropdown parent', function (assert) {
assert.expect(4);
var $ = require('jquery');
@ -58,7 +58,7 @@ test('appends to the dropdown parent', function (assert) {
);
});
test('dropdown is positioned down with static margins', function (assert) {
QUnit.test('dropdown is positioned down with static margins', function (assert) {
var $ = require('jquery');
var $select = $('<select></select>');
var $parent = $('<div></div>');
@ -118,7 +118,7 @@ test('dropdown is positioned down with static margins', function (assert) {
);
});
test('dropdown is positioned down with absolute offsets', function (assert) {
QUnit.test('dropdown is positioned down with absolute offsets', function (assert) {
var $ = require('jquery');
var $select = $('<select></select>');
var $parent = $('<div></div>');

View File

@ -1,4 +1,4 @@
module('Dropdown - Search - Accessibility');
QUnit.module('Dropdown - Search - Accessibility');
var Utils = require('select2/utils');
@ -13,7 +13,7 @@ var $ = require('jquery');
var Options = require('select2/options');
var options = new Options({});
test('role attribute is set to searchbox', function (assert) {
QUnit.test('role attribute is set to searchbox', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -29,7 +29,7 @@ test('role attribute is set to searchbox', function (assert) {
);
});
test('aria-autocomplete attribute is present', function (assert) {
QUnit.test('aria-autocomplete attribute is present', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -45,7 +45,7 @@ test('aria-autocomplete attribute is present', function (assert) {
);
});
test('aria-activedescendant should not be set initiailly', function (assert) {
QUnit.test('aria-activedescendant should not be set initiailly', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -62,7 +62,7 @@ test('aria-activedescendant should not be set initiailly', function (assert) {
);
});
test('aria-activedescendant should be set after highlight', function (assert) {
QUnit.test('aria-activedescendant should be set after highlight', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -86,7 +86,7 @@ test('aria-activedescendant should be set after highlight', function (assert) {
);
});
test('activedescendant should remove if there is no ID', function (assert) {
QUnit.test('activedescendant should remove if there is no ID', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -108,7 +108,7 @@ test('activedescendant should remove if there is no ID', function (assert) {
);
});
test('aria-activedescendant should be removed when closed', function (assert) {
QUnit.test('aria-activedescendant should be removed when closed', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -128,7 +128,7 @@ test('aria-activedescendant should be removed when closed', function (assert) {
);
});
test('aria-controls should not be set initiailly', function (assert) {
QUnit.test('aria-controls should not be set initiailly', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -145,7 +145,7 @@ test('aria-controls should not be set initiailly', function (assert) {
);
});
test('aria-controls should be set when opened', function (assert) {
QUnit.test('aria-controls should be set when opened', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
@ -164,7 +164,7 @@ test('aria-controls should be set when opened', function (assert) {
);
});
test('aria-controls should be removed when closed', function (assert) {
QUnit.test('aria-controls should be removed when closed', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);

View File

@ -1,4 +1,4 @@
module('Dropdown - selectOnClose');
QUnit.module('Dropdown - selectOnClose');
var $ = require('jquery');
@ -16,7 +16,7 @@ var options = new Options({
selectOnClose: true
});
test('will not trigger if no results were given', function (assert) {
QUnit.test('will not trigger if no results were given', function (assert) {
assert.expect(0);
var $element = $('<select></select>');
@ -34,7 +34,7 @@ test('will not trigger if no results were given', function (assert) {
container.trigger('close');
});
test('will not trigger if the results list is empty', function (assert) {
QUnit.test('will not trigger if the results list is empty', function (assert) {
assert.expect(1);
var $element = $('<select></select>');
@ -62,7 +62,7 @@ test('will not trigger if the results list is empty', function (assert) {
container.trigger('close');
});
test('will not trigger if no results here highlighted', function (assert) {
QUnit.test('will not trigger if no results here highlighted', function (assert) {
assert.expect(2);
var $element = $('<select></select>');
@ -101,7 +101,7 @@ test('will not trigger if no results here highlighted', function (assert) {
container.trigger('close');
});
test('will trigger if there is a highlighted result', function (assert) {
QUnit.test('will trigger if there is a highlighted result', function (assert) {
assert.expect(2);
var $element = $('<select></select>');

View File

@ -1,4 +1,4 @@
module('Dropdown - Stoping event propagation');
QUnit.module('Dropdown - Stoping event propagation');
var Dropdown = require('select2/dropdown');
var StopPropagation = require('select2/dropdown/stopPropagation');
@ -11,7 +11,7 @@ var CustomDropdown = Utils.Decorate(Dropdown, StopPropagation);
var options = new Options();
test('click event does not propagate', function (assert) {
QUnit.test('click event does not propagate', function (assert) {
assert.expect(1);
var $container = $('#qunit-fixture .event-container');

View File

@ -1,6 +1,6 @@
module('DOM integration');
QUnit.module('DOM integration');
test('adding a new unselected option changes nothing', function (assert) {
QUnit.test('adding a new unselected option changes nothing', function (assert) {
// Any browsers which support mutation observers will not trigger the event
var expected = 4;
if (window.MutationObserver) {
@ -68,7 +68,7 @@ test('adding a new unselected option changes nothing', function (assert) {
syncDone();
});
test('adding a new selected option changes the value', function (assert) {
QUnit.test('adding a new selected option changes the value', function (assert) {
// handle IE 8 not being supported
var expected = 4;
if (!window.MutationObserver && !window.addEventListener) {
@ -134,7 +134,7 @@ test('adding a new selected option changes the value', function (assert) {
syncDone();
});
test('removing an unselected option changes nothing', function (assert) {
QUnit.test('removing an unselected option changes nothing', function (assert) {
// Any browsers which support mutation observers will not trigger the event
var expected = 4;
if (!window.MutationObserver && !window.addEventListener) {
@ -198,7 +198,7 @@ test('removing an unselected option changes nothing', function (assert) {
syncDone();
});
test('removing a selected option changes the value', function (assert) {
QUnit.test('removing a selected option changes the value', function (assert) {
// handle IE 8 not being supported
var expected = 3;
if (!window.MutationObserver && !window.addEventListener) {
@ -256,7 +256,7 @@ test('removing a selected option changes the value', function (assert) {
syncDone();
});
test('searching tags does not loose focus', function (assert) {
QUnit.test('searching tags does not loose focus', function (assert) {
assert.expect(1);
var asyncDone = assert.async();

View File

@ -1,8 +1,8 @@
module('select2(val)');
QUnit.module('select2(val)');
var Utils = require('select2/utils');
test('multiple elements with arguments works', function (assert) {
QUnit.test('multiple elements with arguments works', function (assert) {
var $ = require('jquery');
require('jquery.select2');
@ -31,7 +31,7 @@ test('multiple elements with arguments works', function (assert) {
);
});
test('initializes when jQuery $.data contains' +
QUnit.test('initializes when jQuery $.data contains' +
' cyclic reference', function (assert) {
var $ = require('jquery');
require('jquery.select2');
@ -60,7 +60,7 @@ test('initializes when jQuery $.data contains' +
);
});
test('$element.data returns instance and options correctly',
QUnit.test('$element.data returns instance and options correctly',
function (assert) {
var $ = require('jquery');
require('jquery.select2');
@ -72,10 +72,10 @@ test('$element.data returns instance and options correctly',
'<option value="3" selected>Three</option>' +
'</select>'
);
// Initialize.
$select.select2({maximumSelectionLength: 2, multiple: true});
assert.equal(
$select.val(),
'3',
@ -83,15 +83,15 @@ test('$element.data returns instance and options correctly',
);
// Try to resolve instance via .data('select2').
var $instance = $select.data('select2');
var $instance = $select.data('select2');
assert.ok($instance);
assert.ok($instance.options);
// Ensure $select.data('select2') is the same instance
// created by .select2()
assert.equal($instance, Utils.GetData($instance.$element[0],
// Ensure $select.data('select2') is the same instance
// created by .select2()
assert.equal($instance, Utils.GetData($instance.$element[0],
'select2'));
// Ensure initialized property matches.
assert.equal($instance.options.options.maximumSelectionLength,
2);

View File

@ -1,10 +1,10 @@
module('select2(data)');
QUnit.module('select2(data)');
var $ = require('jquery');
var Select2 = require('select2/core');
var Options = require('select2/options');
test('single default selection returned', function (assert) {
QUnit.test('single default selection returned', function (assert) {
var $select = $(
'<select>' +
'<option>One</option>' +
@ -39,7 +39,7 @@ test('single default selection returned', function (assert) {
);
});
test('multiple default selections returned', function (assert) {
QUnit.test('multiple default selections returned', function (assert) {
var $select = $(
'<select multiple>' +
'<option selected>One</option>' +
@ -76,9 +76,9 @@ test('multiple default selections returned', function (assert) {
);
});
module('select2(val)');
QUnit.module('select2(val)');
test('single value matches jquery value', function (assert) {
QUnit.test('single value matches jquery value', function (assert) {
var $select = $(
'<select>' +
'<option>One</option>' +
@ -105,7 +105,7 @@ test('single value matches jquery value', function (assert) {
);
});
test('multiple value matches the jquery value', function (assert) {
QUnit.test('multiple value matches the jquery value', function (assert) {
var $select = $(
'<select multiple>' +
'<option selected>One</option>' +

View File

@ -1,6 +1,6 @@
module('Defaults - Ajax');
QUnit.module('Defaults - Ajax');
test('options are merged recursively with default options', function (assert) {
QUnit.test('options are merged recursively with default options', function (assert) {
var defaults = require('select2/defaults');
var ajaxDelay = 250;
@ -31,7 +31,7 @@ test('options are merged recursively with default options', function (assert) {
defaults.reset();
});
test('more than one default option can be changed via set()', function(assert) {
QUnit.test('more than one default option can be changed via set()', function(assert) {
var defaults = require('select2/defaults');
var ajaxDelay = 123;
var dataDataType = 'xml';

View File

@ -1,10 +1,10 @@
module('Options - Attributes');
QUnit.module('Options - Attributes');
var $ = require('jquery');
var Options = require('select2/options');
test('no nesting', function (assert) {
QUnit.test('no nesting', function (assert) {
var $test = $('<select data-test="test"></select>');
var options = new Options({}, $test);
@ -12,7 +12,7 @@ test('no nesting', function (assert) {
assert.equal(options.get('test'), 'test');
});
test('with nesting', function (assert) {
QUnit.test('with nesting', function (assert) {
var $test = $('<select data-first--second="test"></select>');
if ($test[0].dataset == null) {
@ -30,7 +30,7 @@ test('with nesting', function (assert) {
assert.equal(options.get('first').second, 'test');
});
test('overrides initialized data', function (assert) {
QUnit.test('overrides initialized data', function (assert) {
var $test = $('<select data-override="yes" data-data="yes"></select>');
var options = new Options({

View File

@ -1,9 +1,9 @@
module('Options - Deprecated - initSelection');
QUnit.module('Options - Deprecated - initSelection');
var $ = require('jquery');
var Options = require('select2/options');
test('converted into dataAdapter.current', function (assert) {
QUnit.test('converted into dataAdapter.current', function (assert) {
assert.expect(5);
var $test = $('<select></select>');
@ -50,7 +50,7 @@ test('converted into dataAdapter.current', function (assert) {
assert.ok(called, 'initSelection should have been called');
});
test('single option converted to array automatically', function (assert) {
QUnit.test('single option converted to array automatically', function (assert) {
assert.expect(2);
var $test = $('<select></select>');
@ -80,7 +80,7 @@ test('single option converted to array automatically', function (assert) {
assert.ok(called, 'initSelection should have been called');
});
test('only called once', function (assert) {
QUnit.test('only called once', function (assert) {
assert.expect(8);
var $test = $('<select><option value="3" selected>4</option></select>');
@ -157,9 +157,9 @@ test('only called once', function (assert) {
);
});
module('Options - Deprecated - query');
QUnit.module('Options - Deprecated - query');
test('converted into dataAdapter.query automatically', function (assert) {
QUnit.test('converted into dataAdapter.query automatically', function (assert) {
assert.expect(6);
var $test = $('<select></select>');
@ -217,9 +217,9 @@ test('converted into dataAdapter.query automatically', function (assert) {
assert.ok(called, 'The query function should have been called');
});
module('Options - deprecated - data-ajax-url');
QUnit.module('Options - deprecated - data-ajax-url');
test('converted ajax-url to ajax--url automatically', function (assert) {
QUnit.test('converted ajax-url to ajax--url automatically', function (assert) {
var $test = $('<select data-ajax-url="test://url"></select>');
var options = new Options({}, $test);
@ -234,7 +234,7 @@ test('converted ajax-url to ajax--url automatically', function (assert) {
);
});
test('converted select2-tags to data/tags automatically', function (assert) {
QUnit.test('converted select2-tags to data/tags automatically', function (assert) {
var $test = $('<select data-select2-tags="original data"></select>');
var options = new Options({}, $test);

View File

@ -1,3 +1,5 @@
QUnit.module('Options - Translations');
var $ = require('jquery');
var Options = require('select2/options');
var Defaults = require('select2/defaults');
@ -58,7 +60,7 @@ test(
}
);
test('partial dictionaries can be passed', function (assert) {
QUnit.test('partial dictionaries can be passed', function (assert) {
var $element = $('<select></select>');
var options = new Options({

View File

@ -1,11 +1,11 @@
module('Options - Width');
QUnit.module('Options - Width');
var $ = require('jquery');
var Select2 = require('select2/core');
var select = new Select2($('<select></select>'));
test('string passed as width', function (assert) {
QUnit.test('string passed as width', function (assert) {
var $test = $('<select></select>');
var width = select._resolveWidth($test, '80%');
@ -13,7 +13,7 @@ test('string passed as width', function (assert) {
assert.equal(width, '80%');
});
test('width from style attribute', function (assert) {
QUnit.test('width from style attribute', function (assert) {
var $test = $('<select style="width: 50%;"></selct>');
var width = select._resolveWidth($test, 'style');
@ -21,7 +21,7 @@ test('width from style attribute', function (assert) {
assert.equal(width, '50%');
});
test('width from style returns null if nothing is found', function (assert) {
QUnit.test('width from style returns null if nothing is found', function (assert) {
var $test = $('<select></selct>');
var width = select._resolveWidth($test, 'style');
@ -29,7 +29,7 @@ test('width from style returns null if nothing is found', function (assert) {
assert.equal(width, null);
});
test('width from computed element width', function (assert) {
QUnit.test('width from computed element width', function (assert) {
var $style = $(
'<style type="text/css">.css-set-width { width: 500px; }</style>'
);
@ -43,7 +43,7 @@ test('width from computed element width', function (assert) {
assert.equal(width, '500px');
});
test('resolve gets the style if it is there', function (assert) {
QUnit.test('resolve gets the style if it is there', function (assert) {
var $test = $('<select style="width: 20%;"></selct>');
var width = select._resolveWidth($test, 'resolve');
@ -51,7 +51,7 @@ test('resolve gets the style if it is there', function (assert) {
assert.equal(width, '20%');
});
test('resolve falls back to element if there is no style', function (assert) {
QUnit.test('resolve falls back to element if there is no style', function (assert) {
var $style = $(
'<style type="text/css">.css-set-width { width: 500px; }</style>'
);
@ -65,7 +65,7 @@ test('resolve falls back to element if there is no style', function (assert) {
assert.equal(width, '500px');
});
test('computedstyle gets the style if parent is invisible', function (assert) {
QUnit.test('computedstyle gets the style if parent is invisible', function (assert) {
var $style = $(
'<style type="text/css">.css-set-width { width: 500px; }</style>'
);

View File

@ -1,4 +1,4 @@
module('Results - Accessibility');
QUnit.module('Results - Accessibility');
var $ = require('jquery');
@ -6,7 +6,7 @@ var Options = require('select2/options');
var Results = require('select2/results');
test('role of results should be a listbox', function (assert) {
QUnit.test('role of results should be a listbox', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $results = results.render();
@ -14,7 +14,7 @@ test('role of results should be a listbox', function (assert) {
assert.equal($results.attr('role'), 'listbox');
});
test('multiple select should have aria-multiselectable', function (assert) {
QUnit.test('multiple select should have aria-multiselectable', function (assert) {
var results = new Results($('<select></select>'), new Options({
multiple: true
}));

View File

@ -1,6 +1,6 @@
module('Results - highlighting results');
QUnit.module('Results - highlighting results');
test('results:all with no data skips results:focus', function (assert) {
QUnit.test('results:all with no data skips results:focus', function (assert) {
assert.expect(0);
var $ = require('jquery');
@ -42,7 +42,7 @@ test('results:all with no data skips results:focus', function (assert) {
});
});
test('results:all triggers results:focus on the first item', function (assert) {
QUnit.test('results:all triggers results:focus on the first item', function (assert) {
assert.expect(2);
var $ = require('jquery');
@ -90,7 +90,7 @@ test('results:all triggers results:focus on the first item', function (assert) {
});
});
test('results:append does not trigger results:focus', function (assert) {
QUnit.test('results:append does not trigger results:focus', function (assert) {
assert.expect(0);
var $ = require('jquery');
@ -137,7 +137,7 @@ test('results:append does not trigger results:focus', function (assert) {
});
});
test('scrollAfterSelect triggers results:focus', function (assert) {
QUnit.test('scrollAfterSelect triggers results:focus', function (assert) {
assert.expect(3);
var $ = require('jquery');
@ -189,7 +189,7 @@ test('scrollAfterSelect triggers results:focus', function (assert) {
container.trigger('select', {});
});
test('!scrollAfterSelect does not trigger results:focus', function (assert) {
QUnit.test('!scrollAfterSelect does not trigger results:focus', function (assert) {
assert.expect(1);
var $ = require('jquery');

View File

@ -1,6 +1,6 @@
module('Results - Infinite scrolling');
QUnit.module('Results - Infinite scrolling');
test('loadingMore is triggered even without a scrollbar', function (assert) {
QUnit.test('loadingMore is triggered even without a scrollbar', function (assert) {
assert.expect(1);
var $ = require('jquery');
@ -49,7 +49,7 @@ test('loadingMore is triggered even without a scrollbar', function (assert) {
});
});
test('loadingMore is not triggered without scrolling', function (assert) {
QUnit.test('loadingMore is not triggered without scrolling', function (assert) {
assert.expect(0);
var $ = require('jquery');

View File

@ -1,4 +1,4 @@
module('Results - option');
QUnit.module('Results - option');
var $ = require('jquery');
@ -6,7 +6,7 @@ var Options = require('select2/options');
var Results = require('select2/results');
test('disabled property on option is respected - enabled', function (assert) {
QUnit.test('disabled property on option is respected - enabled', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<option></option>');
@ -17,7 +17,7 @@ test('disabled property on option is respected - enabled', function (assert) {
assert.notEqual(option.getAttribute('aria-disabled'), 'true');
});
test('disabled property on option is respected - disabled', function (assert) {
QUnit.test('disabled property on option is respected - disabled', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<option disabled></option>');
@ -28,7 +28,7 @@ test('disabled property on option is respected - disabled', function (assert) {
assert.equal(option.getAttribute('aria-disabled'), 'true');
});
test('disabled property on enabled optgroup is respected', function (assert) {
QUnit.test('disabled property on enabled optgroup is respected', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<optgroup></optgroup>');
@ -39,7 +39,7 @@ test('disabled property on enabled optgroup is respected', function (assert) {
assert.notEqual(option.getAttribute('aria-disabled'), 'true');
});
test('disabled property on disabled optgroup is respected', function (assert) {
QUnit.test('disabled property on disabled optgroup is respected', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<optgroup disabled></optgroup>');
@ -50,7 +50,7 @@ test('disabled property on disabled optgroup is respected', function (assert) {
assert.equal(option.getAttribute('aria-disabled'), 'true');
});
test('option in disabled optgroup is disabled', function (assert) {
QUnit.test('option in disabled optgroup is disabled', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<optgroup disabled><option></option></optgroup>')
@ -62,7 +62,7 @@ test('option in disabled optgroup is disabled', function (assert) {
assert.equal(option.getAttribute('aria-disabled'), 'true');
});
test('options are not selected by default', function (assert) {
QUnit.test('options are not selected by default', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<option></option>');
@ -74,7 +74,7 @@ test('options are not selected by default', function (assert) {
assert.equal(option.getAttribute('aria-selected'), 'false');
});
test('options with children are given the group role', function(assert) {
QUnit.test('options with children are given the group role', function(assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<optgroup></optgroup>');
@ -88,7 +88,7 @@ test('options with children are given the group role', function(assert) {
assert.equal(option.getAttribute('role'), 'group');
});
test('options with children have the aria-label set', function (assert) {
QUnit.test('options with children have the aria-label set', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<optgroup></optgroup>');
@ -103,7 +103,7 @@ test('options with children have the aria-label set', function (assert) {
assert.equal(option.getAttribute('aria-label'), 'test');
});
test('non-group options are given the option role', function (assert) {
QUnit.test('non-group options are given the option role', function (assert) {
var results = new Results($('<select></select>'), new Options({}));
var $option = $('<option></option>');

View File

@ -1,4 +1,4 @@
module('Selection containers - Placeholders - Allow clear');
QUnit.module('Selection containers - Placeholders - Allow clear');
var Placeholder = require('select2/selection/placeholder');
var AllowClear = require('select2/selection/allowClear');
@ -23,7 +23,7 @@ var allowClearOptions = new Options({
allowClear: true
});
test('clear is not displayed for single placeholder', function (assert) {
QUnit.test('clear is not displayed for single placeholder', function (assert) {
var selection = new AllowClearPlaceholder(
$('#qunit-fixture .single-with-placeholder'),
allowClearOptions
@ -42,7 +42,7 @@ test('clear is not displayed for single placeholder', function (assert) {
);
});
test('clear is not displayed for multiple placeholder', function (assert) {
QUnit.test('clear is not displayed for multiple placeholder', function (assert) {
var selection = new AllowClearPlaceholder(
$('#qunit-fixture .multiple'),
allowClearOptions
@ -60,7 +60,7 @@ test('clear is not displayed for multiple placeholder', function (assert) {
});
test('clear is displayed for placeholder', function (assert) {
QUnit.test('clear is displayed for placeholder', function (assert) {
var selection = new AllowClearPlaceholder(
$('#qunit-fixture .single-with-placeholder'),
allowClearOptions
@ -80,7 +80,7 @@ test('clear is displayed for placeholder', function (assert) {
);
});
test('clear icon should have title displayed', function (assert) {
QUnit.test('clear icon should have title displayed', function (assert) {
var selection = new AllowClearPlaceholder(
$('#qunit-fixture .single-with-placeholder'),
allowClearOptions
@ -100,7 +100,7 @@ test('clear icon should have title displayed', function (assert) {
);
});
test('clicking clear will set the placeholder value', function (assert) {
QUnit.test('clicking clear will set the placeholder value', function (assert) {
var $element = $('#qunit-fixture .single-with-placeholder');
var selection = new AllowClearPlaceholder(
@ -129,7 +129,7 @@ test('clicking clear will set the placeholder value', function (assert) {
);
});
test('clicking clear will trigger the unselect event', function (assert) {
QUnit.test('clicking clear will trigger the unselect event', function (assert) {
assert.expect(4);
var $element = $('#qunit-fixture .single-with-placeholder');
@ -178,7 +178,7 @@ test('clicking clear will trigger the unselect event', function (assert) {
$remove.trigger('mousedown');
});
test('preventing the unselect event cancels the clearing', function (assert) {
QUnit.test('preventing the unselect event cancels the clearing', function (assert) {
var $element = $('#qunit-fixture .single-with-placeholder');
var selection = new AllowClearPlaceholder(
@ -211,7 +211,7 @@ test('preventing the unselect event cancels the clearing', function (assert) {
);
});
test('clicking clear will trigger the clear event', function (assert) {
QUnit.test('clicking clear will trigger the clear event', function (assert) {
assert.expect(5);
var $element = $('#qunit-fixture .single-with-placeholder');
@ -266,7 +266,7 @@ test('clicking clear will trigger the clear event', function (assert) {
$remove.trigger('mousedown');
});
test('preventing the clear event cancels the clearing', function (assert) {
QUnit.test('preventing the clear event cancels the clearing', function (assert) {
var $element = $('#qunit-fixture .single-with-placeholder');
var selection = new AllowClearPlaceholder(
@ -299,7 +299,7 @@ test('preventing the clear event cancels the clearing', function (assert) {
);
});
test('clear does not work when disabled', function (assert) {
QUnit.test('clear does not work when disabled', function (assert) {
var $element = $('#qunit-fixture .single-with-placeholder');
var selection = new AllowClearPlaceholder(
@ -330,7 +330,7 @@ test('clear does not work when disabled', function (assert) {
);
});
test('clear button doesnt visually break selected options', function (assert) {
QUnit.test('clear button doesnt visually break selected options', function (assert) {
var $element = $('<select></select>');
var Selection = Utils.Decorate(

View File

@ -1,4 +1,4 @@
module('Dropdown - containerCssClass compatibility');
QUnit.module('Dropdown - containerCssClass compatibility');
var $ = require('jquery');
var Utils = require('select2/utils');
@ -10,7 +10,7 @@ var ContainerCSS = Utils.Decorate(
require('select2/compat/containerCss')
);
test('all classes will be copied if :all: is used', function (assert) {
QUnit.test('all classes will be copied if :all: is used', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
containerCssClass: ':all:'
@ -25,7 +25,7 @@ test('all classes will be copied if :all: is used', function (assert) {
assert.ok(!$container.hasClass(':all:'));
});
test(':all: can be used with other classes', function (assert) {
QUnit.test(':all: can be used with other classes', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
containerCssClass: ':all: other'
@ -41,7 +41,7 @@ test(':all: can be used with other classes', function (assert) {
assert.ok(!$container.hasClass(':all:'));
});
test('classes can be passed in as a string', function (assert) {
QUnit.test('classes can be passed in as a string', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
containerCssClass: 'other'
@ -53,7 +53,7 @@ test('classes can be passed in as a string', function (assert) {
assert.ok($container.hasClass('other'));
});
test('a function can be used based on the element', function (assert){
QUnit.test('a function can be used based on the element', function (assert){
var $element = $('<select class="test"></select>');
var options = new Options({
containerCssClass: function ($element) {
@ -68,7 +68,7 @@ test('a function can be used based on the element', function (assert){
assert.ok(!$container.hasClass('test'));
});
test(':all: works around custom adapters', function (assert) {
QUnit.test(':all: works around custom adapters', function (assert) {
var $element = $('<select class="test"></select>');
var options = new Options({
containerCssClass: ':all: something',
@ -86,9 +86,9 @@ test(':all: works around custom adapters', function (assert) {
assert.ok($container.hasClass('test-modified'));
});
module('Selection - adaptContainerCss compatibility');
QUnit.module('Selection - adaptContainerCss compatibility');
test('only return when adapted', function (assert) {
QUnit.test('only return when adapted', function (assert) {
var $element = $('<select class="original"></select>');
var options = new Options({
adaptContainerCssClass: function (clazz) {

View File

@ -1,4 +1,4 @@
module('Selection containers - Managing focus');
QUnit.module('Selection containers - Managing focus');
var SingleSelection = require('select2/selection/single');
@ -7,7 +7,7 @@ var Options = require('select2/options');
var options = new Options({});
test('close sets the focus to the selection', function (assert) {
QUnit.test('close sets the focus to the selection', function (assert) {
var $container = $('#qunit-fixture .event-container');
var container = new MockContainer();
var selection = new SingleSelection(

View File

@ -1,4 +1,4 @@
module('Selection containers - Multiple');
QUnit.module('Selection containers - Multiple');
var MultipleSelection = require('select2/selection/multiple');
@ -8,7 +8,7 @@ var Utils = require('select2/utils');
var options = new Options({});
test('display uses templateSelection', function (assert) {
QUnit.test('display uses templateSelection', function (assert) {
var called = false;
var templateOptions = new Options({
@ -33,7 +33,7 @@ test('display uses templateSelection', function (assert) {
assert.equal(out, 'test');
});
test('templateSelection can addClass', function (assert) {
QUnit.test('templateSelection can addClass', function (assert) {
var called = false;
var templateOptions = new Options({
@ -62,7 +62,7 @@ test('templateSelection can addClass', function (assert) {
assert.ok($container.hasClass('testclass'));
});
test('empty update clears the selection', function (assert) {
QUnit.test('empty update clears the selection', function (assert) {
var selection = new MultipleSelection(
$('#qunit-fixture .multiple'),
options
@ -82,7 +82,7 @@ test('empty update clears the selection', function (assert) {
);
});
test('empty update clears the selection title', function (assert) {
QUnit.test('empty update clears the selection title', function (assert) {
var selection = new MultipleSelection(
$('#qunit-fixture .multiple'),
options
@ -101,7 +101,7 @@ test('empty update clears the selection title', function (assert) {
);
});
test('update sets the title to the data text', function (assert) {
QUnit.test('update sets the title to the data text', function (assert) {
var selection = new MultipleSelection(
$('#qunit-fixture .multiple'),
options
@ -122,7 +122,7 @@ test('update sets the title to the data text', function (assert) {
);
});
test('update sets the title to the data title', function (assert) {
QUnit.test('update sets the title to the data title', function (assert) {
var selection = new MultipleSelection(
$('#qunit-fixture .multiple'),
options
@ -144,7 +144,7 @@ test('update sets the title to the data title', function (assert) {
);
});
test('update should clear title for placeholder options', function (assert) {
QUnit.test('update should clear title for placeholder options', function (assert) {
var selection = new MultipleSelection(
$('#qunit-fixture .multiple'),
options
@ -166,7 +166,7 @@ test('update should clear title for placeholder options', function (assert) {
);
});
test('update should clear title for options without text', function (assert) {
QUnit.test('update should clear title for options without text', function (assert) {
var selection = new MultipleSelection(
$('#qunit-fixture .multiple'),
options
@ -187,7 +187,7 @@ test('update should clear title for options without text', function (assert) {
);
});
test('escapeMarkup is being used', function (assert) {
QUnit.test('escapeMarkup is being used', function (assert) {
var selection = new MultipleSelection(
$('#qunit-fixture .multiple'),
options
@ -209,7 +209,7 @@ test('escapeMarkup is being used', function (assert) {
);
});
test('clear button respects the disabled state', function (assert) {
QUnit.test('clear button respects the disabled state', function (assert) {
var options = new Options({
disabled: true
});

View File

@ -1,4 +1,4 @@
module('Selection containers - Placeholders');
QUnit.module('Selection containers - Placeholders');
var Placeholder = require('select2/selection/placeholder');
var SingleSelection = require('select2/selection/single');
@ -16,7 +16,7 @@ var placeholderOptions = new Options({
}
});
test('normalizing placeholder ignores objects', function (assert) {
QUnit.test('normalizing placeholder ignores objects', function (assert) {
var selection = new SinglePlaceholder(
$('#qunit-fixture .single'),
placeholderOptions
@ -32,7 +32,7 @@ test('normalizing placeholder ignores objects', function (assert) {
assert.equal(original, normalized);
});
test('normalizing placeholder gives object for string', function (assert) {
QUnit.test('normalizing placeholder gives object for string', function (assert) {
var selection = new SinglePlaceholder(
$('#qunit-fixture .single'),
placeholderOptions
@ -45,7 +45,7 @@ test('normalizing placeholder gives object for string', function (assert) {
});
test('text is shown for placeholder option on single', function (assert) {
QUnit.test('text is shown for placeholder option on single', function (assert) {
var selection = new SinglePlaceholder(
$('#qunit-fixture .single'),
placeholderOptions
@ -60,7 +60,7 @@ test('text is shown for placeholder option on single', function (assert) {
assert.equal($selection.text(), 'This is the placeholder');
});
test('placeholder is shown when no options are selected', function (assert) {
QUnit.test('placeholder is shown when no options are selected', function (assert) {
var selection = new SinglePlaceholder(
$('#qunit-fixture .multiple'),
placeholderOptions

View File

@ -1,4 +1,4 @@
module('Selection containers - Inline search - Accessibility');
QUnit.module('Selection containers - Inline search - Accessibility');
var MultipleSelection = require('select2/selection/multiple');
var InlineSearch = require('select2/selection/search');
@ -9,7 +9,7 @@ var Utils = require('select2/utils');
var Options = require('select2/options');
var options = new Options({});
test('role attribute is set to searchbox', function (assert) {
QUnit.test('role attribute is set to searchbox', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -29,7 +29,7 @@ test('role attribute is set to searchbox', function (assert) {
);
});
test('aria-autocomplete attribute is present', function (assert) {
QUnit.test('aria-autocomplete attribute is present', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -49,7 +49,7 @@ test('aria-autocomplete attribute is present', function (assert) {
);
});
test('aria-activedescendant should not be set initiailly', function (assert) {
QUnit.test('aria-activedescendant should not be set initiailly', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -70,7 +70,7 @@ test('aria-activedescendant should not be set initiailly', function (assert) {
);
});
test('aria-activedescendant should be set after highlight', function (assert) {
QUnit.test('aria-activedescendant should be set after highlight', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -98,7 +98,7 @@ test('aria-activedescendant should be set after highlight', function (assert) {
);
});
test('activedescendant should remove if there is no ID', function (assert) {
QUnit.test('activedescendant should remove if there is no ID', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -124,7 +124,7 @@ test('activedescendant should remove if there is no ID', function (assert) {
);
});
test('aria-activedescendant should be removed when closed', function (assert) {
QUnit.test('aria-activedescendant should be removed when closed', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -148,7 +148,7 @@ test('aria-activedescendant should be removed when closed', function (assert) {
);
});
test('aria-controls should not be set initiailly', function (assert) {
QUnit.test('aria-controls should not be set initiailly', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -169,7 +169,7 @@ test('aria-controls should not be set initiailly', function (assert) {
);
});
test('aria-controls should be set when opened', function (assert) {
QUnit.test('aria-controls should be set when opened', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
@ -192,7 +192,7 @@ test('aria-controls should be set when opened', function (assert) {
);
});
test('aria-controls should be removed when closed', function (assert) {
QUnit.test('aria-controls should be removed when closed', function (assert) {
var $select = $('#qunit-fixture .multiple');
var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);

View File

@ -1,4 +1,4 @@
module('Selection containers - Inline search - Placeholder');
QUnit.module('Selection containers - Inline search - Placeholder');
var MultipleSelection = require('select2/selection/multiple');
var InlineSearch = require('select2/selection/search');
@ -13,7 +13,7 @@ var CustomSelection = Utils.Decorate(
InlineSearch
);
test('width does not extend the search box', function (assert) {
QUnit.test('width does not extend the search box', function (assert) {
assert.expect(2);
var $container = $(

View File

@ -1,4 +1,4 @@
module('Selection containers - Inline search');
QUnit.module('Selection containers - Inline search');
var MultipleSelection = require('select2/selection/multiple');
var InlineSearch = require('select2/selection/search');
@ -9,7 +9,7 @@ var Utils = require('select2/utils');
var options = new Options({});
test('backspace will remove a choice', function (assert) {
QUnit.test('backspace will remove a choice', function (assert) {
assert.expect(3);
var KEYS = require('select2/keys');
@ -51,7 +51,7 @@ test('backspace will remove a choice', function (assert) {
$search.trigger(backspace);
});
test('backspace will set the search text', function (assert) {
QUnit.test('backspace will set the search text', function (assert) {
assert.expect(3);
var KEYS = require('select2/keys');
@ -90,7 +90,7 @@ test('backspace will set the search text', function (assert) {
assert.equal($search.val(), 'One', 'The search text was set');
});
test('updating selection does not shift the focus', function (assert) {
QUnit.test('updating selection does not shift the focus', function (assert) {
// Check for IE 8, which triggers a false negative during testing
if (window.attachEvent && !window.addEventListener) {
// We must expect 0 assertions or the test will fail
@ -138,7 +138,7 @@ test('updating selection does not shift the focus', function (assert) {
);
});
test('the focus event shifts the focus', function (assert) {
QUnit.test('the focus event shifts the focus', function (assert) {
// Check for IE 8, which triggers a false negative during testing
if (window.attachEvent && !window.addEventListener) {
// We must expect 0 assertions or the test will fail
@ -190,7 +190,7 @@ test('the focus event shifts the focus', function (assert) {
);
});
test('search box without text should propagate click', function (assert) {
QUnit.test('search box without text should propagate click', function (assert) {
assert.expect(1);
var $container = $('#qunit-fixture .event-container');
@ -218,7 +218,7 @@ test('search box without text should propagate click', function (assert) {
$search.trigger('click');
});
test('search box with text should not propagate click', function (assert) {
QUnit.test('search box with text should not propagate click', function (assert) {
assert.expect(0);
var $container = $('#qunit-fixture .event-container');
@ -247,7 +247,7 @@ test('search box with text should not propagate click', function (assert) {
$search.trigger('click');
});
test('search box with text should not close dropdown', function (assert) {
QUnit.test('search box with text should not close dropdown', function (assert) {
assert.expect(0);
var $container = $('#qunit-fixture .event-container');

View File

@ -1,4 +1,4 @@
module('Selection containers - Single');
QUnit.module('Selection containers - Single');
var SingleSelection = require('select2/selection/single');
@ -8,7 +8,7 @@ var Utils = require('select2/utils');
var options = new Options({});
test('display uses templateSelection', function (assert) {
QUnit.test('display uses templateSelection', function (assert) {
var called = false;
var templateOptions = new Options({
@ -33,7 +33,7 @@ test('display uses templateSelection', function (assert) {
assert.equal(out, 'test');
});
test('templateSelection can addClass', function (assert) {
QUnit.test('templateSelection can addClass', function (assert) {
var called = false;
var templateOptions = new Options({
@ -62,7 +62,7 @@ test('templateSelection can addClass', function (assert) {
assert.ok($container.hasClass('testclass'));
});
test('empty update clears the selection', function (assert) {
QUnit.test('empty update clears the selection', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options
@ -82,7 +82,7 @@ test('empty update clears the selection', function (assert) {
);
});
test('empty update clears the selection title', function (assert) {
QUnit.test('empty update clears the selection title', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options
@ -102,7 +102,7 @@ test('empty update clears the selection title', function (assert) {
);
});
test('update renders the data text', function (assert) {
QUnit.test('update renders the data text', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options
@ -118,7 +118,7 @@ test('update renders the data text', function (assert) {
assert.equal($rendered.text(), 'test');
});
test('update sets the title to the data text', function (assert) {
QUnit.test('update sets the title to the data text', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options
@ -138,7 +138,7 @@ test('update sets the title to the data text', function (assert) {
);
});
test('update sets the title to the data title', function (assert) {
QUnit.test('update sets the title to the data title', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options
@ -159,7 +159,7 @@ test('update sets the title to the data title', function (assert) {
);
});
test('update should clear title for placeholder options', function (assert) {
QUnit.test('update should clear title for placeholder options', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options
@ -182,7 +182,7 @@ test('update should clear title for placeholder options', function (assert) {
);
});
test('update should clear title for options without text', function (assert) {
QUnit.test('update should clear title for options without text', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options
@ -204,7 +204,7 @@ test('update should clear title for options without text', function (assert) {
);
});
test('escapeMarkup is being used', function (assert) {
QUnit.test('escapeMarkup is being used', function (assert) {
var selection = new SingleSelection(
$('#qunit-fixture .single'),
options

View File

@ -1,4 +1,4 @@
module('Selection containers - Stoping event propagation');
QUnit.module('Selection containers - Stoping event propagation');
var SingleSelection = require('select2/selection/single');
var StopPropagation = require('select2/selection/stopPropagation');
@ -11,7 +11,7 @@ var CutomSelection = Utils.Decorate(SingleSelection, StopPropagation);
var options = new Options();
test('click event does not propagate', function (assert) {
QUnit.test('click event does not propagate', function (assert) {
assert.expect(1);
var $container = $('#qunit-fixture .event-container');

View File

@ -1,9 +1,9 @@
module('Utils - RemoveData');
QUnit.module('Utils - RemoveData');
var $ = require('jquery');
var Utils = require('select2/utils');
test('The data-select2-id attribute is removed', function (assert) {
QUnit.test('The data-select2-id attribute is removed', function (assert) {
var $element = $('<select data-select2-id="test"></select>');
Utils.RemoveData($element[0]);
@ -15,7 +15,7 @@ test('The data-select2-id attribute is removed', function (assert) {
);
});
test('The internal cache for the element is cleared', function (assert) {
QUnit.test('The internal cache for the element is cleared', function (assert) {
var $element = $('<select data-select2-id="test"></select>');
Utils.__cache.test = {
@ -27,7 +27,7 @@ test('The internal cache for the element is cleared', function (assert) {
assert.equal(Utils.__cache.test, null, 'The cache should now be empty');
});
test('Calling it on an element without data works', function (assert) {
QUnit.test('Calling it on an element without data works', function (assert) {
assert.expect(0);
var $element = $('<select></select>');

View File

@ -1,8 +1,8 @@
module('Decorators');
QUnit.module('Decorators');
var Utils = require('select2/utils');
test('overridden - method', function (assert) {
QUnit.test('overridden - method', function (assert) {
function BaseClass () {}
BaseClass.prototype.hello = function () {
@ -22,7 +22,7 @@ test('overridden - method', function (assert) {
assert.strictEqual(inst.hello(), 'B');
});
test('overridden - constructor', function (assert) {
QUnit.test('overridden - constructor', function (assert) {
function BaseClass () {
this.inherited = true;
}
@ -47,7 +47,7 @@ test('overridden - constructor', function (assert) {
assert.ok(!inst.inherited);
});
test('not overridden - method', function (assert) {
QUnit.test('not overridden - method', function (assert) {
function BaseClass () {}
BaseClass.prototype.hello = function () {
@ -67,7 +67,7 @@ test('not overridden - method', function (assert) {
assert.strictEqual(inst.hello(), 'A');
});
test('not overridden - constructor', function (assert) {
QUnit.test('not overridden - constructor', function (assert) {
function BaseClass () {
this.called = true;
}
@ -89,7 +89,7 @@ test('not overridden - constructor', function (assert) {
assert.ok(inst.called);
});
test('inherited - method', function (assert) {
QUnit.test('inherited - method', function (assert) {
function BaseClass () {}
BaseClass.prototype.hello = function () {
@ -109,7 +109,7 @@ test('inherited - method', function (assert) {
assert.strictEqual(inst.hello(), 'BAC');
});
test('inherited - constructor', function (assert) {
QUnit.test('inherited - constructor', function (assert) {
function BaseClass () {
this.inherited = true;
}
@ -136,7 +136,7 @@ test('inherited - constructor', function (assert) {
assert.ok(inst.inherited);
});
test('inherited - three levels', function (assert) {
QUnit.test('inherited - three levels', function (assert) {
function BaseClass (testArgument) {
this.baseCalled = true;
this.baseTestArgument = testArgument;

View File

@ -1,15 +1,15 @@
module('Utils - escapeMarkup');
QUnit.module('Utils - escapeMarkup');
var Utils = require('select2/utils');
test('text passes through', function (assert) {
QUnit.test('text passes through', function (assert) {
var text = 'testing this';
var escaped = Utils.escapeMarkup(text);
assert.equal(text, escaped);
});
test('html tags are escaped', function (assert) {
QUnit.test('html tags are escaped', function (assert) {
var text = '<script>alert("bad");</script>';
var escaped = Utils.escapeMarkup(text);
@ -17,7 +17,7 @@ test('html tags are escaped', function (assert) {
assert.equal(escaped.indexOf('<script>'), -1);
});
test('quotes are killed as well', function (assert) {
QUnit.test('quotes are killed as well', function (assert) {
var text = 'testin\' these "quotes"';
var escaped = Utils.escapeMarkup(text);
@ -26,7 +26,7 @@ test('quotes are killed as well', function (assert) {
assert.equal(escaped.indexOf('"'), -1);
});
test('DocumentFragment options pass through', function (assert) {
QUnit.test('DocumentFragment options pass through', function (assert) {
var frag = document.createDocumentFragment();
frag.innerHTML = '<strong>test</strong>';