diff options
-rw-r--r-- | lib/caldav/resources/calendar.js | 1 | ||||
-rw-r--r-- | lib/caldav/xhr.js | 11 | ||||
-rwxr-xr-x | scripts/connect | 2 | ||||
-rw-r--r-- | test/caldav/xhr_test.js | 23 | ||||
-rw-r--r-- | test/support/fake_xhr.js | 1 |
5 files changed, 35 insertions, 3 deletions
diff --git a/lib/caldav/resources/calendar.js b/lib/caldav/resources/calendar.js index cc8a4d6..9bff517 100644 --- a/lib/caldav/resources/calendar.js +++ b/lib/caldav/resources/calendar.js @@ -34,6 +34,7 @@ 'calendar-description': 'description', 'getctag': 'ctag', + 'getlastmodified': 'lastmodified', 'resourcetype': { field: 'resourcetype', diff --git a/lib/caldav/xhr.js b/lib/caldav/xhr.js index 84fb18d..ac26865 100644 --- a/lib/caldav/xhr.js +++ b/lib/caldav/xhr.js @@ -41,8 +41,7 @@ } Xhr.prototype = { - /** @scope Caldav.Xhr.prototype */ - + globalXhrOptions: null, xhrClass: Native, method: 'GET', async: true, @@ -79,7 +78,13 @@ callback = this.callback; } - xhr = this.xhr = new this.xhrClass(); + if (this.globalXhrOptions) { + xhr = new this.xhrClass(this.globalXhrOptions); + } else { + xhr = new this.xhrClass(); + } + + this.xhr = xhr; if (Xhr.authHack) { xhr.open(this.method, this.url, this.async); diff --git a/scripts/connect b/scripts/connect index aa342f6..c604fa2 100755 --- a/scripts/connect +++ b/scripts/connect @@ -50,6 +50,8 @@ function getCalendarDetails(caluri) { resources.prop(['caldav', 'calendar-timezone']); resources.prop('displayname'); resources.prop('resourcetype'); + resources.prop('getlastmodified'); + resources.prop('current-user-privilege-set') resources.prop(['calserver', 'getctag']); // found calendar home find calendars. diff --git a/test/caldav/xhr_test.js b/test/caldav/xhr_test.js index c442852..1082958 100644 --- a/test/caldav/xhr_test.js +++ b/test/caldav/xhr_test.js @@ -24,6 +24,29 @@ suite('webacls/xhr', function() { assert.equal(subject.method, 'POST'); }); + suite('with global args', function() { + var old; + var opts = { system: true }; + + setup(function() { + var old = Xhr.prototype.globalXhrOptions; + Xhr.prototype.globalXhrOptions = opts; + }); + + teardown(function() { + Xhr.prototype.globalXhrOptions = old; + }); + + test('constructed xhr', function() { + var subject = new Xhr({ + method: 'POST', + xhrClass: FakeXhr + }); + subject.send(function() {}); + assert.ok(subject.xhr); + assert.equal(subject.xhr.constructorArgs[0], opts); + }); + }); }); suite('.abort', function() { diff --git a/test/support/fake_xhr.js b/test/support/fake_xhr.js index 3f0c9d9..0ffcff8 100644 --- a/test/support/fake_xhr.js +++ b/test/support/fake_xhr.js @@ -5,6 +5,7 @@ this.sendArgs = null; this.headers = {}; this.responseHeaders = {}; + this.constructorArgs = arguments; FakeXhr.instances.push(this); } |