aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/httpBackendSpec.js
diff options
context:
space:
mode:
authorVojta Jina2012-08-04 12:11:00 -0700
committerIgor Minar2012-08-10 16:17:59 -0700
commite0a54f6b206dc2b6595f2bc3a17c5932e7477545 (patch)
tree4db991fbffe6258f52e59a47039f0aea8fab3341 /test/ng/httpBackendSpec.js
parent9767f7bdd3e1ce6f65bdea992d67369ead13d813 (diff)
downloadangular.js-e0a54f6b206dc2b6595f2bc3a17c5932e7477545.tar.bz2
feat($http): support reponseType
Closes #1013
Diffstat (limited to 'test/ng/httpBackendSpec.js')
-rw-r--r--test/ng/httpBackendSpec.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ng/httpBackendSpec.js b/test/ng/httpBackendSpec.js
index 06b63c3c..a491ae26 100644
--- a/test/ng/httpBackendSpec.js
+++ b/test/ng/httpBackendSpec.js
@@ -135,6 +135,24 @@ describe('$httpBackend', function() {
});
+ it('should set responseType and return xhr.response', function() {
+ $backend('GET', '/whatever', null, callback, {}, null, null, 'blob');
+
+ var xhrInstance = MockXhr.$$lastInstance;
+ expect(xhrInstance.responseType).toBe('blob');
+
+ callback.andCallFake(function(status, response) {
+ expect(response).toBe(xhrInstance.response);
+ });
+
+ xhrInstance.response = {some: 'object'};
+ xhrInstance.readyState = 4;
+ xhrInstance.onreadystatechange();
+
+ expect(callback).toHaveBeenCalledOnce();
+ });
+
+
describe('JSONP', function() {
var SCRIPT_URL = /([^\?]*)\?cb=angular\.callbacks\.(.*)/;