timeFormat.js
2.27 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
describe('timeFormat', function() {
var options;
beforeEach(function() {
affix('#cal');
options = {
defaultDate: '2014-06-04',
events: [ {
title: 'my event',
start: '2014-06-04T15:00:00',
end: '2014-06-04T17:00:00'
} ]
};
});
function getRenderedEventTime() {
return $('.fc-event:first .fc-time').text();
}
describe('when in month view', function() {
beforeEach(function() {
options.defaultView = 'month';
});
it('renders correctly when default', function() {
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('3p');
});
it('renders correctly when default and the language is customized', function() {
options.lang = 'en-gb';
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('15');
});
it('renders correctly when customized', function() {
options.timeFormat = 'Hh:mm:mm';
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('153:00:00');
});
});
describe('when in agendaWeek view', function() {
beforeEach(function() {
options.defaultView = 'agendaWeek';
});
it('renders correctly when default', function() {
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('3:00 - 5:00');
});
it('renders correctly when default and the language is customized', function() {
options.lang = 'en-gb';
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('15:00 - 17:00');
});
it('renders correctly when customized', function() {
options.timeFormat = 'Hh:mm:mm';
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('153:00:00 - 175:00:00');
});
});
describe('when in multi-day custom basic view', function() {
beforeEach(function() {
options.views = {
basicTwoDay: {
type: 'basic',
duration: { days: 2 }
}
};
options.defaultView = 'basicTwoDay';
});
it('defaults to no end time', function() {
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('3p');
});
});
describe('when in basicDay view', function() {
beforeEach(function() {
options.defaultView = 'basicDay';
});
it('defaults to showing the end time', function() {
$('#cal').fullCalendar(options);
expect(getRenderedEventTime()).toBe('3p - 5p');
});
});
});