forked from select2/select2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch-tests.js
More file actions
49 lines (37 loc) · 1.25 KB
/
Copy pathsearch-tests.js
File metadata and controls
49 lines (37 loc) · 1.25 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
module('Dropdown - Search');
var Dropdown = require('select2/dropdown');
var DropdownSearch = Utils.Decorate(
Dropdown,
require('select2/dropdown/search')
);
var $ = require('jquery');
var Options = require('select2/options');
var Utils = require('select2/utils');
var options = new Options({});
test('search box defaults autocomplete to off', function (assert) {
var $select = $('#qunit-fixture .single');
var dropdown = new DropdownSearch($select, options);
var $dropdown = dropdown.render();
var container = new MockContainer();
dropdown.bind(container, $('<span></span>'));
assert.equal(
$dropdown.find('input').attr('autocomplete'),
'off',
'The search box has autocomplete disabled'
);
});
test('search box sets autocomplete from options', function (assert) {
var $select = $('#qunit-fixture .single');
var autocompleteOptions = new Options({
autocomplete: 'country-name'
});
var dropdown = new DropdownSearch($select, autocompleteOptions);
var $dropdown = dropdown.render();
var container = new MockContainer();
dropdown.bind(container, $('<span></span>'));
assert.equal(
$dropdown.find('input').attr('autocomplete'),
'country-name',
'The search box sets the right autocomplete attribute'
);
});