Fixed jshint errors as a result of prepending QUnit
This commit is contained in:
parent
0241a48a8c
commit
f9f43c854c
@ -259,7 +259,9 @@ QUnit.test('option tags are automatically generated', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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);
|
||||
@ -275,7 +277,8 @@ QUnit.test('automatically generated option tags have a result id', function (ass
|
||||
Utils.GetData($select.find(':selected')[0], 'data')._resultId,
|
||||
'<option> default should have a result ID assigned'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('option tags can receive new data', function(assert) {
|
||||
var $select = $('#qunit-fixture .single');
|
||||
@ -354,7 +357,9 @@ QUnit.test('optgroup tags have the right properties', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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>' +
|
||||
@ -383,4 +388,5 @@ QUnit.test('existing selections are respected on initialization', function (asse
|
||||
data.bind(container, $('<div></div>'));
|
||||
|
||||
assert.equal($select.val(), 'Second');
|
||||
});
|
||||
}
|
||||
);
|
@ -37,7 +37,9 @@ QUnit.test('test that options can be selected', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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: [
|
||||
{
|
||||
@ -63,7 +65,8 @@ QUnit.test('unselect the single selected option clears the value', function (ass
|
||||
'',
|
||||
'The id should no longer be in the value'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('options can be unselected individually', function (assert) {
|
||||
var options = new Options({
|
||||
|
@ -417,7 +417,9 @@ QUnit.test('empty optgroups are still shown when queried', function (assert) {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.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);
|
||||
@ -444,7 +446,8 @@ QUnit.test('multiple options with the same value are returned', function (assert
|
||||
'The duplicates do not have the same text'
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('data objects use the text of the option', function (assert) {
|
||||
var $select = $('#qunit-fixture .duplicates');
|
||||
@ -459,7 +462,9 @@ QUnit.test('data objects use the text of the option', function (assert) {
|
||||
assert.equal(item.text, '&');
|
||||
});
|
||||
|
||||
QUnit.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'}];
|
||||
@ -473,7 +478,8 @@ QUnit.test('select option construction accepts id=0 (zero) value', function (ass
|
||||
'0',
|
||||
'Built option value should be "0" (zero as a string).'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('select option construction accepts id="" (empty string) value',
|
||||
function (assert) {
|
||||
|
@ -64,7 +64,9 @@ QUnit.test('white space is trimmed by default', function (assert) {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.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({
|
||||
@ -77,7 +79,8 @@ QUnit.test('does not create option if text is same but lowercase', function (ass
|
||||
assert.equal(item.id, 'One');
|
||||
assert.equal(item.text, 'One');
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('does not trigger for additional pages', function (assert) {
|
||||
var data = new SelectTags($('#qunit-fixture .single'), options);
|
||||
@ -191,7 +194,9 @@ QUnit.test('insertTag controls the tag location', function (assert) {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.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);
|
||||
@ -209,7 +214,8 @@ QUnit.test('insertTag can be controlled through the options', function (assert)
|
||||
assert.equal(item.id, 'o');
|
||||
assert.equal(item.text, 'o');
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('createTag controls the tag object', function (assert) {
|
||||
var data = new SelectTags($('#qunit-fixture .single'), options);
|
||||
|
@ -58,7 +58,9 @@ QUnit.test('appends to the dropdown parent', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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>');
|
||||
@ -116,9 +118,12 @@ QUnit.test('dropdown is positioned down with static margins', function (assert)
|
||||
'10px',
|
||||
'The offset should be 10px on the left'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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>');
|
||||
@ -174,4 +179,5 @@ QUnit.test('dropdown is positioned down with absolute offsets', function (assert
|
||||
'0px',
|
||||
'There should not be an extra left offset'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
@ -45,7 +45,9 @@ QUnit.test('aria-autocomplete attribute is present', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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);
|
||||
@ -60,9 +62,12 @@ QUnit.test('aria-activedescendant should not be set initiailly', function (asser
|
||||
!$search.attr('aria-activedescendant'),
|
||||
'The search box should not point to anything when it is first rendered'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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);
|
||||
@ -84,9 +89,12 @@ QUnit.test('aria-activedescendant should be set after highlight', function (asse
|
||||
'test',
|
||||
'The search is pointing to the focused result'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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);
|
||||
@ -106,9 +114,12 @@ QUnit.test('activedescendant should remove if there is no ID', function (assert)
|
||||
!$search.attr('aria-activedescendant'),
|
||||
'There is no result for the search to be pointing to'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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);
|
||||
@ -126,7 +137,8 @@ QUnit.test('aria-activedescendant should be removed when closed', function (asse
|
||||
!$search.attr('aria-activedescendant'),
|
||||
'There is no active descendant when the dropdown is closed'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('aria-controls should not be set initiailly', function (assert) {
|
||||
var $select = $('#qunit-fixture .single');
|
||||
|
@ -62,11 +62,15 @@ QUnit.test('will not trigger if the results list is empty', function (assert) {
|
||||
container.trigger('close');
|
||||
});
|
||||
|
||||
QUnit.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>');
|
||||
var select = new ModifiedResults($element, options, new SelectData($element));
|
||||
var select = new ModifiedResults(
|
||||
$element, options, new SelectData($element)
|
||||
);
|
||||
|
||||
var $dropdown = select.render();
|
||||
|
||||
@ -99,7 +103,8 @@ QUnit.test('will not trigger if no results here highlighted', function (assert)
|
||||
);
|
||||
|
||||
container.trigger('close');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('will trigger if there is a highlighted result', function (assert) {
|
||||
assert.expect(2);
|
||||
|
@ -1,6 +1,8 @@
|
||||
QUnit.module('Defaults - Ajax');
|
||||
|
||||
QUnit.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;
|
||||
@ -29,9 +31,12 @@ QUnit.test('options are merged recursively with default options', function (asse
|
||||
);
|
||||
|
||||
defaults.reset();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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';
|
||||
@ -47,4 +52,5 @@ QUnit.test('more than one default option can be changed via set()', function(ass
|
||||
dataDataType,
|
||||
'Both ajax.delay and ajax.dataType present in defaults');
|
||||
defaults.reset();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -234,7 +234,9 @@ QUnit.test('converted ajax-url to ajax--url automatically', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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);
|
||||
|
||||
@ -247,4 +249,5 @@ QUnit.test('converted select2-tags to data/tags automatically', function (assert
|
||||
'original data',
|
||||
'The `data` key is created with the original data'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ var $ = require('jquery');
|
||||
var Options = require('select2/options');
|
||||
var Defaults = require('select2/defaults');
|
||||
|
||||
module('Options - Translations', {
|
||||
QUnit.module('Options - Translations', {
|
||||
beforeEach: function () {
|
||||
Defaults.reset();
|
||||
},
|
||||
@ -13,7 +13,9 @@ module('Options - Translations', {
|
||||
}
|
||||
});
|
||||
|
||||
test('partial dictonaries are reset when default reset', function (assert) {
|
||||
QUnit.test(
|
||||
'partial dictonaries are reset when default reset',
|
||||
function (assert) {
|
||||
Defaults.set('language', {
|
||||
test: 'testing'
|
||||
});
|
||||
@ -24,9 +26,10 @@ test('partial dictonaries are reset when default reset', function (assert) {
|
||||
!Defaults.defaults.language.test,
|
||||
'The partial dictionary should have been reset'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
test('default language chain is English', function (assert) {
|
||||
QUnit.test('default language chain is English', function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
var options = new Options({}, $element);
|
||||
@ -37,7 +40,7 @@ test('default language chain is English', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
QUnit.test(
|
||||
'default translation includes all of the required messages',
|
||||
function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
@ -86,7 +89,9 @@ QUnit.test('partial dictionaries can be passed', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('partial dictionaries can be combined with defaults', function (assert) {
|
||||
QUnit.test(
|
||||
'partial dictionaries can be combined with defaults',
|
||||
function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
Defaults.set('language', {
|
||||
@ -122,9 +127,12 @@ test('partial dictionaries can be combined with defaults', function (assert) {
|
||||
'No results found',
|
||||
'You can still get English translations for keys not passed in'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
test('partial dictionaries can used in fallback chains', function (assert) {
|
||||
QUnit.test(
|
||||
'partial dictionaries can used in fallback chains',
|
||||
function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
var options = new Options({
|
||||
@ -161,9 +169,10 @@ test('partial dictionaries can used in fallback chains', function (assert) {
|
||||
'No results found',
|
||||
'You can still get English translations for keys not passed in'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
test('language can be set via the options', function (assert) {
|
||||
QUnit.test('language can be set via the options', function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
var options = new Options({
|
||||
@ -176,7 +185,7 @@ test('language can be set via the options', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('multi-part language is broken out', function (assert) {
|
||||
QUnit.test('multi-part language is broken out', function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
var options = new Options({
|
||||
@ -189,7 +198,7 @@ test('multi-part language is broken out', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('default language can be set', function (assert) {
|
||||
QUnit.test('default language can be set', function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
Defaults.set('language', 'es');
|
||||
@ -202,7 +211,7 @@ test('default language can be set', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('lanugage set via options adds to default chain', function (assert) {
|
||||
QUnit.test('lanugage set via options adds to default chain', function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
Defaults.set('language', 'es');
|
||||
@ -217,7 +226,7 @@ test('lanugage set via options adds to default chain', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('default language chain can be set', function (assert) {
|
||||
QUnit.test('default language chain can be set', function (assert) {
|
||||
var $element = $('<select></select>');
|
||||
|
||||
Defaults.set('language', ['es', 'it', 'en']);
|
||||
@ -230,7 +239,7 @@ test('default language chain can be set', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('language can be set by lang attr', function (assert) {
|
||||
QUnit.test('language can be set by lang attr', function (assert) {
|
||||
var $element = $('<select lang="es"></select>');
|
||||
|
||||
var options = new Options({}, $element);
|
||||
@ -241,7 +250,7 @@ test('language can be set by lang attr', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('language can be inherited by lang attr', function (assert) {
|
||||
QUnit.test('language can be inherited by lang attr', function (assert) {
|
||||
var $element = $('<div lang="es"><select></select></div>').find('select');
|
||||
|
||||
var options = new Options({}, $element);
|
||||
@ -252,8 +261,12 @@ test('language can be inherited by lang attr', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('multi-part language can be inherited by lang attr', function (assert) {
|
||||
var $element = $('<div lang="pt-BR"><select></select></div>').find('select');
|
||||
QUnit.test(
|
||||
'multi-part language can be inherited by lang attr',
|
||||
function (assert) {
|
||||
var $element = $(
|
||||
'<div lang="pt-BR"><select></select></div>'
|
||||
).find('select');
|
||||
|
||||
var options = new Options({}, $element);
|
||||
|
||||
@ -261,9 +274,10 @@ test('multi-part language can be inherited by lang attr', function (assert) {
|
||||
options.get('language'),
|
||||
['pt-BR', 'pt', 'en']
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
test('lang attr overrides default language', function (assert) {
|
||||
QUnit.test('lang attr overrides default language', function (assert) {
|
||||
var $element = $('<select lang="it"></select>');
|
||||
|
||||
Defaults.set('language', 'es');
|
||||
@ -276,7 +290,7 @@ test('lang attr overrides default language', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
test('default language overrides inherited lang attr', function (assert) {
|
||||
QUnit.test('default language overrides inherited lang attr', function (assert) {
|
||||
var $element = $('<div lang="it"><select></select></div>').find('select');
|
||||
|
||||
Defaults.set('language', 'es');
|
||||
|
@ -21,13 +21,16 @@ QUnit.test('width from style attribute', function (assert) {
|
||||
assert.equal(width, '50%');
|
||||
});
|
||||
|
||||
QUnit.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');
|
||||
|
||||
assert.equal(width, null);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('width from computed element width', function (assert) {
|
||||
var $style = $(
|
||||
@ -51,7 +54,9 @@ QUnit.test('resolve gets the style if it is there', function (assert) {
|
||||
assert.equal(width, '20%');
|
||||
});
|
||||
|
||||
QUnit.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>'
|
||||
);
|
||||
@ -63,9 +68,12 @@ QUnit.test('resolve falls back to element if there is no style', function (asser
|
||||
var width = select._resolveWidth($test, 'resolve');
|
||||
|
||||
assert.equal(width, '500px');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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>'
|
||||
);
|
||||
@ -81,4 +89,5 @@ QUnit.test('computedstyle gets the style if parent is invisible', function (asse
|
||||
var width = select._resolveWidth($test.find('select'), 'computedstyle');
|
||||
|
||||
assert.equal(width, '500px');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -14,7 +14,9 @@ QUnit.test('role of results should be a listbox', function (assert) {
|
||||
assert.equal($results.attr('role'), 'listbox');
|
||||
});
|
||||
|
||||
QUnit.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
|
||||
}));
|
||||
@ -22,4 +24,5 @@ QUnit.test('multiple select should have aria-multiselectable', function (assert)
|
||||
var $results = results.render();
|
||||
|
||||
assert.equal($results.attr('aria-multiselectable'), 'true');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -42,7 +42,9 @@ QUnit.test('results:all with no data skips results:focus', function (assert) {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.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');
|
||||
@ -88,7 +90,8 @@ QUnit.test('results:all triggers results:focus on the first item', function (ass
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('results:append does not trigger results:focus', function (assert) {
|
||||
assert.expect(0);
|
||||
@ -189,7 +192,9 @@ QUnit.test('scrollAfterSelect triggers results:focus', function (assert) {
|
||||
container.trigger('select', {});
|
||||
});
|
||||
|
||||
QUnit.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');
|
||||
@ -238,4 +243,5 @@ QUnit.test('!scrollAfterSelect does not trigger results:focus', function (assert
|
||||
});
|
||||
|
||||
container.trigger('select', {});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -1,6 +1,8 @@
|
||||
QUnit.module('Results - Infinite scrolling');
|
||||
|
||||
QUnit.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');
|
||||
@ -47,7 +49,8 @@ QUnit.test('loadingMore is triggered even without a scrollbar', function (assert
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('loadingMore is not triggered without scrolling', function (assert) {
|
||||
assert.expect(0);
|
||||
|
@ -6,7 +6,9 @@ var Options = require('select2/options');
|
||||
|
||||
var Results = require('select2/results');
|
||||
|
||||
QUnit.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>');
|
||||
@ -15,9 +17,12 @@ QUnit.test('disabled property on option is respected - enabled', function (asser
|
||||
});
|
||||
|
||||
assert.notEqual(option.getAttribute('aria-disabled'), 'true');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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>');
|
||||
@ -26,9 +31,12 @@ QUnit.test('disabled property on option is respected - disabled', function (asse
|
||||
});
|
||||
|
||||
assert.equal(option.getAttribute('aria-disabled'), 'true');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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>');
|
||||
@ -37,9 +45,12 @@ QUnit.test('disabled property on enabled optgroup is respected', function (asser
|
||||
});
|
||||
|
||||
assert.notEqual(option.getAttribute('aria-disabled'), 'true');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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>');
|
||||
@ -48,7 +59,8 @@ QUnit.test('disabled property on disabled optgroup is respected', function (asse
|
||||
});
|
||||
|
||||
assert.equal(option.getAttribute('aria-disabled'), 'true');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('option in disabled optgroup is disabled', function (assert) {
|
||||
var results = new Results($('<select></select>'), new Options({}));
|
||||
|
@ -42,7 +42,9 @@ QUnit.test('clear is not displayed for single placeholder', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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
|
||||
@ -57,8 +59,8 @@ QUnit.test('clear is not displayed for multiple placeholder', function (assert)
|
||||
0,
|
||||
'The clear icon should not be displayed'
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('clear is displayed for placeholder', function (assert) {
|
||||
var selection = new AllowClearPlaceholder(
|
||||
@ -178,7 +180,9 @@ QUnit.test('clicking clear will trigger the unselect event', function (assert) {
|
||||
$remove.trigger('mousedown');
|
||||
});
|
||||
|
||||
QUnit.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(
|
||||
@ -209,7 +213,8 @@ QUnit.test('preventing the unselect event cancels the clearing', function (asser
|
||||
'One',
|
||||
'The placeholder should not have been set'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('clicking clear will trigger the clear event', function (assert) {
|
||||
assert.expect(5);
|
||||
@ -266,7 +271,9 @@ QUnit.test('clicking clear will trigger the clear event', function (assert) {
|
||||
$remove.trigger('mousedown');
|
||||
});
|
||||
|
||||
QUnit.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(
|
||||
@ -297,7 +304,8 @@ QUnit.test('preventing the clear event cancels the clearing', function (assert)
|
||||
'One',
|
||||
'The placeholder should not have been set'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('clear does not work when disabled', function (assert) {
|
||||
var $element = $('#qunit-fixture .single-with-placeholder');
|
||||
@ -330,7 +338,9 @@ QUnit.test('clear does not work when disabled', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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(
|
||||
@ -397,4 +407,5 @@ QUnit.test('clear button doesnt visually break selected options', function (asse
|
||||
doubleHeight,
|
||||
'There should be two full lines of selections'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -144,7 +144,8 @@ QUnit.test('update sets the title to the data title', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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
|
||||
@ -164,9 +165,11 @@ QUnit.test('update should clear title for placeholder options', function (assert
|
||||
undefined,
|
||||
'The title should be removed if a placeholder is rendered'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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
|
||||
|
@ -32,7 +32,9 @@ QUnit.test('normalizing placeholder ignores objects', function (assert) {
|
||||
assert.equal(original, normalized);
|
||||
});
|
||||
|
||||
QUnit.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
|
||||
@ -42,8 +44,8 @@ QUnit.test('normalizing placeholder gives object for string', function (assert)
|
||||
|
||||
assert.equal(normalized.id, '');
|
||||
assert.equal(normalized.text, 'placeholder');
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('text is shown for placeholder option on single', function (assert) {
|
||||
var selection = new SinglePlaceholder(
|
||||
@ -60,7 +62,9 @@ QUnit.test('text is shown for placeholder option on single', function (assert) {
|
||||
assert.equal($selection.text(), 'This is the placeholder');
|
||||
});
|
||||
|
||||
QUnit.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
|
||||
@ -71,4 +75,5 @@ QUnit.test('placeholder is shown when no options are selected', function (assert
|
||||
selection.update([]);
|
||||
|
||||
assert.equal($selection.text(), 'This is the placeholder');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -49,7 +49,9 @@ QUnit.test('aria-autocomplete attribute is present', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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);
|
||||
@ -68,9 +70,12 @@ QUnit.test('aria-activedescendant should not be set initiailly', function (asser
|
||||
!$search.attr('aria-activedescendant'),
|
||||
'The search box should not point to anything when it is first rendered'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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);
|
||||
@ -96,9 +101,12 @@ QUnit.test('aria-activedescendant should be set after highlight', function (asse
|
||||
'test',
|
||||
'The search is pointing to the focused result'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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);
|
||||
@ -122,9 +130,12 @@ QUnit.test('activedescendant should remove if there is no ID', function (assert)
|
||||
!$search.attr('aria-activedescendant'),
|
||||
'There is no result for the search to be pointing to'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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);
|
||||
@ -146,7 +157,8 @@ QUnit.test('aria-activedescendant should be removed when closed', function (asse
|
||||
!$search.attr('aria-activedescendant'),
|
||||
'There is no active descendant when the dropdown is closed'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('aria-controls should not be set initiailly', function (assert) {
|
||||
var $select = $('#qunit-fixture .multiple');
|
||||
|
@ -218,7 +218,9 @@ QUnit.test('search box without text should propagate click', function (assert) {
|
||||
$search.trigger('click');
|
||||
});
|
||||
|
||||
QUnit.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');
|
||||
@ -245,7 +247,8 @@ QUnit.test('search box with text should not propagate click', function (assert)
|
||||
var $search = $selection.find('input');
|
||||
$search.val('test');
|
||||
$search.trigger('click');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('search box with text should not close dropdown', function (assert) {
|
||||
assert.expect(0);
|
||||
|
@ -159,7 +159,9 @@ QUnit.test('update sets the title to the data title', function (assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.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
|
||||
@ -180,9 +182,12 @@ QUnit.test('update should clear title for placeholder options', function (assert
|
||||
undefined,
|
||||
'The title should be removed if a placeholder is rendered'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.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
|
||||
@ -202,7 +207,8 @@ QUnit.test('update should clear title for options without text', function (asser
|
||||
undefined,
|
||||
'The title should be removed if there is no text or title property'
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test('escapeMarkup is being used', function (assert) {
|
||||
var selection = new SingleSelection(
|
||||
|
Loading…
Reference in New Issue
Block a user