aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Lal <james@lightsofapollo.com>2012-07-20 09:13:46 -0700
committerJames Lal <james@lightsofapollo.com>2012-07-20 09:13:46 -0700
commit08a6ce10660e4436d48ad85075d6d092431b426e (patch)
treebb3a7905043d2ae3a15f8b3da6962d8279e1e33d /test
parent5a97196b49640117c546ad59cbfa31f974259f0b (diff)
downloadjsCalDAV-08a6ce10660e4436d48ad85075d6d092431b426e.tar.gz
global xhr constructor options can now be set ( for system xhr in b2g)
Diffstat (limited to 'test')
-rw-r--r--test/caldav/xhr_test.js23
-rw-r--r--test/support/fake_xhr.js1
2 files changed, 24 insertions, 0 deletions
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);
}