now.js
1.52 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
describe('now', function() {
var options;
beforeEach(function() {
affix('#cal');
options = {
defaultDate: '2014-05-01'
};
});
describe('when month view', function() {
beforeEach(function() {
options.defaultView = 'month';
});
it('changes the highlighted day when customized', function() {
options.now = '2014-05-06';
$('#cal').fullCalendar(options);
var todayCell = $('#cal td.fc-today');
var todayDate = todayCell.data('date');
expect(todayDate).toEqual('2014-05-06');
});
});
describe('when agendaWeek view', function() {
beforeEach(function() {
options.defaultView = 'agendaWeek';
});
it('changes the highlighted day when customized', function() {
options.now = '2014-04-29T12:00:00';
$('#cal').fullCalendar(options);
var todayCell = $('#cal td.fc-today');
expect(todayCell.data('date')).toBe('2014-04-29');
});
});
it('accepts a function that returns a moment', function() {
options.defaultView = 'month';
options.now = function() {
return moment.utc('2014-05-01');
};
$('#cal').fullCalendar(options);
var todayCell = $('#cal td.fc-today');
var todayDate = todayCell.data('date');
expect(todayDate).toEqual('2014-05-01');
});
it('accepts a function that returns a moment-ish string', function() {
options.defaultView = 'month';
options.now = function() {
return '2014-05-01';
};
$('#cal').fullCalendar(options);
var todayCell = $('#cal td.fc-today');
var todayDate = todayCell.data('date');
expect(todayDate).toEqual('2014-05-01');
});
});