eventLimitText.js
1.31 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
describe('eventLimitText', function() {
var options;
beforeEach(function() {
affix('#cal');
options = {
defaultDate: '2014-08-01', // important that it is the first week, so works w/ month + week views
defaultView: 'month',
eventLimit: 3,
events: [
{ title: 'event1', start: '2014-07-29' },
{ title: 'event2', start: '2014-07-29' },
{ title: 'event2', start: '2014-07-29' },
{ title: 'event2', start: '2014-07-29' }
]
};
});
it('allows a string', function() {
options.eventLimitText = 'extra';
$('#cal').fullCalendar(options);
expect($('.fc-more')).toHaveText('+2 extra');
});
it('allows a function', function() {
options.eventLimitText = function(n) {
expect(typeof n).toBe('number');
return 'there are ' + n + ' more events!';
};
$('#cal').fullCalendar(options);
expect($('.fc-more')).toHaveText('there are 2 more events!');
});
it('has a default value that is affected by the custom locale', function() {
options.lang = 'fr';
$('#cal').fullCalendar(options);
expect($('.fc-more')).toHaveText('+2 en plus');
});
it('is not affected by a custom locale when the value is explicitly specified', function() {
options.lang = 'fr';
options.eventLimitText = 'extra';
$('#cal').fullCalendar(options);
expect($('.fc-more')).toHaveText('+2 extra');
});
});