unselectAuto.js
1.21 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
56
describe('unselectAuto', function() {
var options;
beforeEach(function() {
options = {
selectable: true,
defaultDate: '2014-12-25',
defaultView: 'month'
};
affix('#cal');
affix('#otherthing');
});
describe('when enabled', function() {
beforeEach(function() {
options.unselectAuto = true;
});
it('unselects the current selection when clicking elsewhere in DOM', function() {
$('#cal').fullCalendar(options);
$('#cal').fullCalendar('select', '2014-12-01', '2014-12-03');
expect($('.fc-highlight').length).toBeGreaterThan(0);
$('#otherthing')
.simulate('mousedown')
.simulate('mouseup')
.simulate('click');
expect($('.fc-highlight').length).toBe(0);
});
});
describe('when disabled', function() {
beforeEach(function() {
options.unselectAuto = false;
});
it('keeps current selection when clicking elsewhere in DOM', function() {
$('#cal').fullCalendar(options);
$('#cal').fullCalendar('select', '2014-12-01', '2014-12-03');
expect($('.fc-highlight').length).toBeGreaterThan(0);
$('#otherthing')
.simulate('mousedown')
.simulate('mouseup')
.simulate('click');
expect($('.fc-highlight').length).toBeGreaterThan(0);
});
});
});