From 6fcfb7c04d32e1c8b26a312295bf7ac3ec2d2ad7 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Fri, 13 Jul 2018 19:06:45 +0200
Subject: Fixed many permissions and began admin interface
---
.../select2/tests/a11y/search-tests.js | 51 +
.../select2/tests/a11y/selection-tests.js | 154 +
.../select2/tests/data/array-tests.js | 318 +
.../select2/tests/data/base-tests.js | 29 +
.../select2/tests/data/inputData-tests.js | 158 +
.../select2/tests/data/maximumInputLength-tests.js | 138 +
.../tests/data/maximumSelectionLength-tests.js | 202 +
.../select2/tests/data/minimumInputLength-tests.js | 138 +
.../select2/tests/data/select-tests.js | 489 +
.../select2/tests/data/tags-tests.js | 276 +
.../select2/tests/data/tokenizer-tests.js | 219 +
.../select2/tests/dropdown/dropdownCss-tests.js | 104 +
.../select2/tests/dropdown/positioning-tests.js | 177 +
.../select2/tests/dropdown/selectOnClose-tests.js | 137 +
.../tests/dropdown/stopPropagation-tests.js | 33 +
public/bower_components/select2/tests/helpers.js | 46 +
.../select2/tests/integration.html | 21 +
.../select2/tests/integration/dom-changes.js | 257 +
.../select2/tests/integration/jquery-calls.js | 30 +
.../select2/tests/integration/select2-methods.js | 139 +
.../select2/tests/options/ajax-tests.js | 32 +
.../select2/tests/options/data-tests.js | 44 +
.../select2/tests/options/deprecated-tests.js | 250 +
.../select2/tests/options/translation-tests.js | 28 +
.../select2/tests/options/width-tests.js | 66 +
.../select2/tests/results/focusing-tests.js | 138 +
.../select2/tests/selection/allowClear-tests.js | 218 +
.../select2/tests/selection/containerCss-tests.js | 104 +
.../select2/tests/selection/multiple-tests.js | 149 +
.../select2/tests/selection/placeholder-tests.js | 74 +
.../select2/tests/selection/search-tests.js | 191 +
.../select2/tests/selection/single-tests.js | 117 +
.../tests/selection/stopPropagation-tests.js | 33 +
public/bower_components/select2/tests/unit.html | 95 +
.../select2/tests/utils/decorator-tests.js | 189 +
.../select2/tests/utils/escapeMarkup-tests.js | 36 +
.../select2/tests/vendor/jquery-1.7.2.js | 9404 ++++++++++++++++++++
.../select2/tests/vendor/qunit-1.23.1.css | 305 +
.../select2/tests/vendor/qunit-1.23.1.js | 4334 +++++++++
39 files changed, 18923 insertions(+)
create mode 100644 public/bower_components/select2/tests/a11y/search-tests.js
create mode 100644 public/bower_components/select2/tests/a11y/selection-tests.js
create mode 100644 public/bower_components/select2/tests/data/array-tests.js
create mode 100644 public/bower_components/select2/tests/data/base-tests.js
create mode 100644 public/bower_components/select2/tests/data/inputData-tests.js
create mode 100644 public/bower_components/select2/tests/data/maximumInputLength-tests.js
create mode 100644 public/bower_components/select2/tests/data/maximumSelectionLength-tests.js
create mode 100644 public/bower_components/select2/tests/data/minimumInputLength-tests.js
create mode 100644 public/bower_components/select2/tests/data/select-tests.js
create mode 100644 public/bower_components/select2/tests/data/tags-tests.js
create mode 100644 public/bower_components/select2/tests/data/tokenizer-tests.js
create mode 100644 public/bower_components/select2/tests/dropdown/dropdownCss-tests.js
create mode 100644 public/bower_components/select2/tests/dropdown/positioning-tests.js
create mode 100644 public/bower_components/select2/tests/dropdown/selectOnClose-tests.js
create mode 100644 public/bower_components/select2/tests/dropdown/stopPropagation-tests.js
create mode 100644 public/bower_components/select2/tests/helpers.js
create mode 100644 public/bower_components/select2/tests/integration.html
create mode 100644 public/bower_components/select2/tests/integration/dom-changes.js
create mode 100644 public/bower_components/select2/tests/integration/jquery-calls.js
create mode 100644 public/bower_components/select2/tests/integration/select2-methods.js
create mode 100644 public/bower_components/select2/tests/options/ajax-tests.js
create mode 100644 public/bower_components/select2/tests/options/data-tests.js
create mode 100644 public/bower_components/select2/tests/options/deprecated-tests.js
create mode 100644 public/bower_components/select2/tests/options/translation-tests.js
create mode 100644 public/bower_components/select2/tests/options/width-tests.js
create mode 100644 public/bower_components/select2/tests/results/focusing-tests.js
create mode 100644 public/bower_components/select2/tests/selection/allowClear-tests.js
create mode 100644 public/bower_components/select2/tests/selection/containerCss-tests.js
create mode 100644 public/bower_components/select2/tests/selection/multiple-tests.js
create mode 100644 public/bower_components/select2/tests/selection/placeholder-tests.js
create mode 100644 public/bower_components/select2/tests/selection/search-tests.js
create mode 100644 public/bower_components/select2/tests/selection/single-tests.js
create mode 100644 public/bower_components/select2/tests/selection/stopPropagation-tests.js
create mode 100644 public/bower_components/select2/tests/unit.html
create mode 100644 public/bower_components/select2/tests/utils/decorator-tests.js
create mode 100644 public/bower_components/select2/tests/utils/escapeMarkup-tests.js
create mode 100644 public/bower_components/select2/tests/vendor/jquery-1.7.2.js
create mode 100644 public/bower_components/select2/tests/vendor/qunit-1.23.1.css
create mode 100644 public/bower_components/select2/tests/vendor/qunit-1.23.1.js
(limited to 'public/bower_components/select2/tests')
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, $(''));
+
+ // 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'
+ );
+});
diff --git a/public/bower_components/select2/tests/a11y/selection-tests.js b/public/bower_components/select2/tests/a11y/selection-tests.js
new file mode 100644
index 0000000..e2c1460
--- /dev/null
+++ b/public/bower_components/select2/tests/a11y/selection-tests.js
@@ -0,0 +1,154 @@
+module('Accessibility - All');
+
+var BaseSelection = require('select2/selection/base');
+var SingleSelection = require('select2/selection/single');
+var MultipleSelection = require('select2/selection/multiple');
+
+var $ = require('jquery');
+
+var Options = require('select2/options');
+var options = new Options({});
+
+test('title is carried over from original element', function (assert) {
+ var $select = $('#qunit-fixture .single');
+
+ var selection = new BaseSelection($select, options);
+ var $selection = selection.render();
+
+ assert.equal(
+ $selection.attr('title'),
+ $select.attr('title'),
+ 'The title should have been copied over from the original element'
+ );
+});
+
+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 container = new MockContainer();
+
+ selection.bind(container, $(''));
+
+ assert.equal(
+ $selection.attr('aria-expanded'),
+ 'false',
+ 'The container should not be expanded when it is closed'
+ );
+
+ container.trigger('open');
+
+ assert.equal(
+ $selection.attr('aria-expanded'),
+ 'true',
+ 'The container should be expanded when it is opened'
+ );
+});
+
+test('static aria attributes are present', function (assert) {
+ var $select = $('#qunit-fixture .single');
+
+ var selection = new BaseSelection($select, options);
+ var $selection = selection.render();
+
+ assert.equal(
+ $selection.attr('role'),
+ 'combobox',
+ 'The container should identify as a combobox'
+ );
+
+ assert.equal(
+ $selection.attr('aria-haspopup'),
+ 'true',
+ 'The dropdown is considered a popup of the container'
+ );
+});
+
+test('the container should be in the tab order', function (assert) {
+ var $select = $('#qunit-fixture .single');
+
+ var selection = new BaseSelection($select, options);
+ var $selection = selection.render();
+
+ var container = new MockContainer();
+ selection.bind(container, $(''));
+
+ assert.equal(
+ $selection.attr('tabindex'),
+ '0',
+ 'The tab index should allow it to fit in the natural tab order'
+ );
+
+ container.trigger('disable');
+
+ assert.equal(
+ $selection.attr('tabindex'),
+ '-1',
+ 'The selection should be dropped out of the tab order when disabled'
+ );
+
+ container.trigger('enable');
+
+ assert.equal(
+ $selection.attr('tabindex'),
+ '0',
+ 'The tab index should be restored when re-enabled'
+ );
+});
+
+test('a custom tabindex is copied', function (assert) {
+ var $select = $('#qunit-fixture .single');
+ $select.attr('tabindex', '999');
+
+ var selection = new BaseSelection($select, options);
+ var $selection = selection.render();
+
+ var container = new MockContainer();
+ selection.bind(container, $(''));
+
+ assert.equal(
+ $selection.attr('tabindex'),
+ '999',
+ 'The tab index should match the original tab index'
+ );
+
+ container.trigger('disable');
+
+ assert.equal(
+ $selection.attr('tabindex'),
+ '-1',
+ 'The selection should be dropped out of the tab order when disabled'
+ );
+
+ container.trigger('enable');
+
+ assert.equal(
+ $selection.attr('tabindex'),
+ '999',
+ 'The tab index should be restored when re-enabled'
+ );
+});
+
+module('Accessibility - Single');
+
+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 container = new MockContainer();
+ selection.bind(container, $(''));
+
+ var $rendered = $selection.find('.select2-selection__rendered');
+
+ assert.equal(
+ $selection.attr('aria-labelledby'),
+ $rendered.attr('id'),
+ 'The rendered selection should label the container'
+ );
+});
+
+module('Accessibility - Multiple');
diff --git a/public/bower_components/select2/tests/data/array-tests.js b/public/bower_components/select2/tests/data/array-tests.js
new file mode 100644
index 0000000..65a6e32
--- /dev/null
+++ b/public/bower_components/select2/tests/data/array-tests.js
@@ -0,0 +1,318 @@
+module('Data adapters - Array');
+
+var ArrayData = require('select2/data/array');
+var $ = require('jquery');
+var Options = require('select2/options');
+
+var arrayOptions = new Options({
+ data: [
+ {
+ id: 'default',
+ text: 'Default'
+ },
+ {
+ id: '1',
+ text: 'One'
+ },
+ {
+ id: '2',
+ text: '2'
+ }
+ ]
+});
+
+var extraOptions = new Options ({
+ data: [
+ {
+ id: 'default',
+ text: 'Default',
+ extra: true
+ },
+ {
+ id: 'One',
+ text: 'One',
+ extra: true
+ }
+ ]
+});
+
+var nestedOptions = new Options({
+ data: [
+ {
+ text: 'Default',
+ children: [
+ {
+ text: 'Next',
+ children: [
+ {
+ id: 'a',
+ text: 'Option'
+ }
+ ]
+ }
+ ]
+ }
+ ]
+});
+
+test('current gets default for single', function (assert) {
+ var $select = $('#qunit-fixture .single-empty');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ data.current(function (val) {
+ assert.equal(
+ val.length,
+ 1,
+ 'There should always be a selected item for array data.'
+ );
+
+ var item = val[0];
+
+ assert.equal(
+ item.id,
+ 'default',
+ 'The first item should be selected'
+ );
+ });
+});
+
+test('current gets default for multiple', function (assert) {
+ var $select = $('#qunit-fixture .multiple');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ data.current(function (val) {
+ assert.equal(
+ val.length,
+ 0,
+ 'There should be no default selection.'
+ );
+ });
+});
+
+test('current works with existing selections', function (assert) {
+ var $select = $('#qunit-fixture .multiple');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ $select.val(['One']);
+
+ data.current(function (val) {
+ assert.equal(
+ val.length,
+ 1,
+ 'There should only be one existing selection.'
+ );
+
+ var option = val[0];
+
+ assert.equal(
+ option.id,
+ 'One',
+ 'The id should be equal to the value of the option tag.'
+ );
+
+ assert.equal(
+ option.text,
+ 'One',
+ 'The text should be equal to the text of the option tag.'
+ );
+ });
+});
+
+test('current works with selected data', function (assert) {
+ var $select = $('#qunit-fixture .single-empty');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ data.select({
+ id: '2',
+ text: '2'
+ });
+
+ data.current(function (val) {
+ assert.equal(
+ val.length,
+ 1,
+ 'There should only be one option selected.'
+ );
+
+ var option = val[0];
+
+ assert.equal(
+ option.id,
+ '2',
+ 'The id should match the original id from the array.'
+ );
+
+ assert.equal(
+ option.text,
+ '2',
+ 'The text should match the original text from the array.'
+ );
+ });
+});
+
+test('select works for single', function (assert) {
+ var $select = $('#qunit-fixture .single-empty');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ assert.equal(
+ $select.val(),
+ 'default',
+ 'There should already be a selection'
+ );
+
+ data.select({
+ id: '1',
+ text: 'One'
+ });
+
+ assert.equal(
+ $select.val(),
+ '1',
+ 'The selected value should be the same as the selected id'
+ );
+});
+
+test('multiple sets the value', function (assert) {
+ var $select = $('#qunit-fixture .multiple');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ assert.equal($select.val(), null);
+
+ data.select({
+ id: 'default',
+ text: 'Default'
+ });
+
+ assert.deepEqual($select.val(), ['default']);
+});
+
+test('multiple adds to the old value', function (assert) {
+ var $select = $('#qunit-fixture .multiple');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ $select.val(['One']);
+
+ assert.deepEqual($select.val(), ['One']);
+
+ data.select({
+ id: 'default',
+ text: 'Default'
+ });
+
+ assert.deepEqual($select.val(), ['One', 'default']);
+});
+
+test('option tags are automatically generated', function (assert) {
+ var $select = $('#qunit-fixture .single-empty');
+
+ var data = new ArrayData($select, arrayOptions);
+
+ assert.equal(
+ $select.find('option').length,
+ 3,
+ 'An