event-feed-param.js
1.99 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
describe('event feed params', function() {
var options;
beforeEach(function() {
affix('#cal');
options = {
defaultDate: '2014-05-01',
defaultView: 'month'
};
$.mockjax({
url: '*',
contentType: 'text/json',
responseText: [
{
title: 'my event',
start: '2014-05-21'
}
]
});
$.mockjaxSettings.log = function() { }; // don't console.log
});
afterEach(function() {
$.mockjaxClear();
});
it('utilizes custom startParam, endParam, and timezoneParam names', function() {
options.events = 'my-feed.php';
options.timezone = 'America/Los_Angeles';
options.startParam = 'mystart';
options.endParam = 'myend';
options.timezoneParam = 'currtz';
$('#cal').fullCalendar(options);
var request = $.mockjax.mockedAjaxCalls()[0];
expect(request.data.start).toBeUndefined();
expect(request.data.end).toBeUndefined();
expect(request.data.timezone).toBeUndefined();
expect(request.data.mystart).toEqual('2014-04-27');
expect(request.data.myend).toEqual('2014-06-08');
expect(request.data.currtz).toEqual('America/Los_Angeles');
});
it('utilizes event-source-specific startParam, endParam, and timezoneParam names', function() {
options.timezone = 'America/Los_Angeles';
options.startParam = 'mystart';
options.endParam = 'myend';
options.timezoneParam = 'currtz';
options.eventSources = [
{
url: 'my-feed.php',
startParam: 'feedstart',
endParam: 'feedend',
timezoneParam: 'feedctz'
}
];
$('#cal').fullCalendar(options);
var request = $.mockjax.mockedAjaxCalls()[0];
expect(request.data.start).toBeUndefined();
expect(request.data.end).toBeUndefined();
expect(request.data.timezone).toBeUndefined();
expect(request.data.mystart).toBeUndefined();
expect(request.data.myend).toBeUndefined();
expect(request.data.currtz).toBeUndefined();
expect(request.data.feedstart).toEqual('2014-04-27');
expect(request.data.feedend).toEqual('2014-06-08');
expect(request.data.feedctz).toEqual('America/Los_Angeles');
});
});