-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathevents_dom.js
64 lines (58 loc) · 1.41 KB
/
events_dom.js
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
56
57
58
59
60
61
62
63
64
describe('DOM Events', function() {
describe('"change"', function() {
it('should be triggered once by addItem()', function(done) {
var test = setup_test('<select>', {
valueField: 'value',
labelField: 'value',
options: [
{value: 'a'},
{value: 'b'},
],
items: ['a']
});
var counter = 0;
test.$select.on('change', function() { counter++; });
test.selectize.addItem('b');
window.setTimeout(function() {
expect(counter).to.be.equal(1);
done();
}, 0);
});
it('should be triggered once by removeItem()', function(done) {
var test = setup_test('<select multiple>', {
valueField: 'value',
labelField: 'value',
options: [
{value: 'a'},
{value: 'b'},
],
items: ['a','b']
});
var counter = 0;
test.$select.on('change', function() { counter++; });
test.selectize.removeItem('b');
window.setTimeout(function() {
expect(counter).to.be.equal(1);
done();
}, 0);
});
it('should be triggered once by clear()', function(done) {
var test = setup_test('<select multiple>', {
valueField: 'value',
labelField: 'value',
options: [
{value: 'a'},
{value: 'b'},
],
items: ['a','b']
});
var counter = 0;
test.$select.on('change', function() { counter++; });
test.selectize.clear();
window.setTimeout(function() {
expect(counter).to.be.equal(1);
done();
}, 0);
});
});
});