Skip to content

Commit

Permalink
fix extraParams not being accepted. fixes #4446
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Mar 8, 2019
1 parent 4a8a01c commit 1d4f7f1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/event-sources/json-feed-event-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let eventSourceDef: EventSourceDef = {
return {
url: raw.url,
method: (raw.method || 'GET').toUpperCase(),
extraParams: raw.data,
extraParams: raw.extraParams,
startParam: raw.startParam,
endParam: raw.endParam,
timeZoneParam: raw.timeZoneParam
Expand Down
27 changes: 25 additions & 2 deletions tests/automated/legacy/events-json-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('events as a json feed', function() {
})
})

it('accepts a dynamic data function', function(done) {
it('accepts an extraParams object', function(done) {

XHRMock.get(/^my-feed\.php/, function(req, res) {
expect(req.url().query).toEqual({
Expand All @@ -140,7 +140,30 @@ describe('events as a json feed', function() {
initCalendar({
eventSources: [ {
url: 'my-feed.php',
data: function() {
extraParams: {
customParam: 'heckyeah'
}
} ]
})
})

it('accepts a dynamic extraParams function', function(done) {

XHRMock.get(/^my-feed\.php/, function(req, res) {
expect(req.url().query).toEqual({
timeZone: 'UTC',
start: '2014-04-27T00:00:00Z',
end: '2014-06-08T00:00:00Z',
customParam: 'heckyeah'
})
done()
return res.status(200).header('content-type', 'application/json').body('[]')
})

initCalendar({
eventSources: [ {
url: 'my-feed.php',
extraParams: function() {
return {
customParam: 'heckyeah'
}
Expand Down

0 comments on commit 1d4f7f1

Please sign in to comment.