forked from select2/select2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselectionCss-tests.js
More file actions
55 lines (44 loc) · 1.63 KB
/
Copy pathselectionCss-tests.js
File metadata and controls
55 lines (44 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module('Dropdown - selectionCssClass');
var $ = require('jquery');
var Utils = require('select2/utils');
var Options = require('select2/options');
var SingleSelection = require('select2/selection/single');
var SelectionCSS = Utils.Decorate(
SingleSelection,
require('select2/selection/selectionCss')
);
test('all classes will be copied if :all: is used', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
selectionCssClass: ':all:'
});
var select = new SelectionCSS($element, options);
var $container = select.render();
assert.ok($container.hasClass('test'));
assert.ok($container.hasClass('copy'));
assert.ok($container.hasClass('works'));
assert.ok(!$container.hasClass(':all:'));
});
test(':all: can be used with other classes', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
selectionCssClass: ':all: other'
});
var select = new SelectionCSS($element, options);
var $container = select.render();
assert.ok($container.hasClass('test'));
assert.ok($container.hasClass('copy'));
assert.ok($container.hasClass('works'));
assert.ok($container.hasClass('other'));
assert.ok(!$container.hasClass(':all:'));
});
test('classes can be passed in as a string', function (assert) {
var $element = $('<select class="test copy works"></select>');
var options = new Options({
selectionCssClass: 'other'
});
var select = new SelectionCSS($element, options);
var $container = select.render();
assert.ok($container.hasClass('other'));
assert.ok(!$container.hasClass('copy'));
});