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/integration/select2-methods.js | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 public/bower_components/select2/tests/integration/select2-methods.js (limited to 'public/bower_components/select2/tests/integration/select2-methods.js') diff --git a/public/bower_components/select2/tests/integration/select2-methods.js b/public/bower_components/select2/tests/integration/select2-methods.js new file mode 100644 index 0000000..b1e344a --- /dev/null +++ b/public/bower_components/select2/tests/integration/select2-methods.js @@ -0,0 +1,139 @@ +module('select2(data)'); + +var $ = require('jquery'); +var Select2 = require('select2/core'); +var Options = require('select2/options'); + +test('single default selection returned', function (assert) { + var $select = $( + '' + ); + var options = new Options({}); + + var select = new Select2($select, options); + + var items = select.data(); + + assert.equal( + items.length, + 1, + 'The one selected item should be returned' + ); + + var first = items[0]; + + assert.equal( + first.id, + '3', + 'The first option was correct' + ); + + assert.equal( + first.text, + 'Three', + 'The first option was correct' + ); +}); + +test('multiple default selections returned', function (assert) { + var $select = $( + '' + ); + var options = new Options({}); + + var select = new Select2($select, options); + + var items = select.data(); + + assert.equal( + items.length, + 2, + 'The two selected items should be returned' + ); + + var first = items[0]; + + assert.equal( + first.id, + 'One', + 'The first option was correct' + ); + + var second = items[1]; + + assert.equal( + second.id, + '3', + 'The option value should be pulled correctly' + ); +}); + +module('select2(val)'); + +test('single value matches jquery value', function (assert) { + var $select = $( + '' + ); + var options = new Options({}); + + var select = new Select2($select, options); + + var value = select.val(); + + assert.equal( + value, + '3', + 'The value should match the option tag attribute' + ); + + assert.equal( + value, + $select.val(), + 'The value should match the jquery value' + ); +}); + +test('multiple value matches the jquery value', function (assert) { + var $select = $( + '' + ); + var options = new Options({}); + + var select = new Select2($select, options); + + var value = select.val(); + + assert.equal( + value.length, + 2, + 'Two options should be selected' + ); + + assert.deepEqual( + value, + ['One', '3'], + 'The values should match the option tag attribute' + ); + + assert.deepEqual( + value, + $select.val(), + 'The values should match the jquery values' + ); +}); -- cgit v1.2.3