header-navigation.js
1.79 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
describe('header navigation', function() {
beforeEach(function() {
affix('#calendar');
var options = {
header: {
left: 'next,prev,prevYear,nextYear today',
center: '',
right: 'title'
}
};
$('#calendar').fullCalendar(options);
});
describe('and click next', function() {
it('should change view to next month', function() {
$('#calendar').fullCalendar('gotoDate', '2010-02-01');
$('.fc-next-button').simulate('click');
var newDate = $('#calendar').fullCalendar('getDate');
expect(newDate).toEqualMoment('2010-03-01');
});
});
describe('and click prev', function() {
it('should change view to prev month', function() {
$('#calendar').fullCalendar('gotoDate', '2010-02-01');
$('.fc-prev-button').simulate('click');
var newDate = $('#calendar').fullCalendar('getDate');
expect(newDate).toEqualMoment('2010-01-01');
});
});
describe('and click prevYear', function() {
it('should change view to prev month', function() {
$('#calendar').fullCalendar('gotoDate', '2010-02-01');
$('.fc-prevYear-button').simulate('click');
var newDate = $('#calendar').fullCalendar('getDate');
expect(newDate).toEqualMoment('2009-02-01');
});
});
describe('and click nextYear', function() {
it('should change view to prev month', function() {
$('#calendar').fullCalendar('gotoDate', '2010-02-01');
$('.fc-nextYear-button').simulate('click');
var newDate = $('#calendar').fullCalendar('getDate');
expect(newDate).toEqualMoment('2011-02-01');
});
});
describe('and click today', function() {
it('should change view to prev month', function() {
$('#calendar').fullCalendar('gotoDate', '2010-02-01');
$('.fc-today-button').simulate('click');
var newDate = $('#calendar').fullCalendar('getDate');
expect(newDate).toEqualNow();
});
});
});