aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bower_components/select2/tests/a11y/search-tests.js
diff options
context:
space:
mode:
authorMarvin Borner2018-07-13 19:06:45 +0200
committerMarvin Borner2018-07-13 19:06:45 +0200
commit6fcfb7c04d32e1c8b26a312295bf7ac3ec2d2ad7 (patch)
treedbc87ef16fa01d5d99116de283592b8fe5e02944 /public/bower_components/select2/tests/a11y/search-tests.js
parentdfd839f27146df0ad0494e11734fc7d310c70ebf (diff)
Fixed many permissions and began admin interface
Diffstat (limited to 'public/bower_components/select2/tests/a11y/search-tests.js')
-rw-r--r--public/bower_components/select2/tests/a11y/search-tests.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/public/bower_components/select2/tests/a11y/search-tests.js b/public/bower_components/select2/tests/a11y/search-tests.js
new file mode 100644
index 0000000..58e5649
--- /dev/null
+++ b/public/bower_components/select2/tests/a11y/search-tests.js
@@ -0,0 +1,51 @@
+module('Accessibility - Search');
+
+var MultipleSelection = require('select2/selection/multiple');
+var InlineSearch = require('select2/selection/search');
+
+var $ = require('jquery');
+
+var Utils = require('select2/utils');
+var Options = require('select2/options');
+var options = new Options({});
+
+test('aria-autocomplete attribute is present', function (assert) {
+ var $select = $('#qunit-fixture .multiple');
+
+ var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
+ var selection = new CustomSelection($select, options);
+ var $selection = selection.render();
+
+ // Update the selection so the search is rendered
+ selection.update([]);
+
+ assert.equal(
+ $selection.find('input').attr('aria-autocomplete'),
+ 'list',
+ 'The search box is marked as autocomplete'
+ );
+});
+
+test('aria-activedescendant should be removed when closed', function (assert) {
+ var $select = $('#qunit-fixture .multiple');
+
+ var CustomSelection = Utils.Decorate(MultipleSelection, InlineSearch);
+ var selection = new CustomSelection($select, options);
+ var $selection = selection.render();
+
+ var container = new MockContainer();
+ selection.bind(container, $('<span></span>'));
+
+ // Update the selection so the search is rendered
+ selection.update([]);
+
+ var $search = $selection.find('input');
+ $search.attr('aria-activedescendant', 'something');
+
+ container.trigger('close');
+
+ assert.ok(
+ !$search.attr('aria-activedescendant'),
+ 'There is no active descendant when the dropdown is closed'
+ );
+});