aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/ngIncludeSpec.js
diff options
context:
space:
mode:
authorSylvester Keil2013-02-26 10:22:12 +0100
committerJames deBoer2013-03-27 13:13:59 -0700
commit4ae46814ff4e7c0bbcdbbefc0a97277283a84065 (patch)
tree2c5bcbe2d5bcc143043cb989d8b40899eb5ef8f9 /test/ng/directive/ngIncludeSpec.js
parent5c735eb4ab07144a62949472ed388cb185099201 (diff)
downloadangular.js-4ae46814ff4e7c0bbcdbbefc0a97277283a84065.tar.bz2
feat(http): support request/response promise chaining
myApp.factory('myAroundInterceptor', function($rootScope, $timeout) { return function(configPromise, responsePromise) { return { request: configPromise.then(function(config) { return config }); response: responsePromise.then(function(response) { return 'ha!'; } }); } myApp.config(function($httpProvider){ $httpProvider.aroundInterceptors.push('myAroundInterceptor'); });
Diffstat (limited to 'test/ng/directive/ngIncludeSpec.js')
-rw-r--r--test/ng/directive/ngIncludeSpec.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js
index 7c94a70e..dce803b5 100644
--- a/test/ng/directive/ngIncludeSpec.js
+++ b/test/ng/directive/ngIncludeSpec.js
@@ -178,25 +178,23 @@ describe('ngInclude', function() {
it('should discard pending xhr callbacks if a new template is requested before the current ' +
'finished loading', inject(function($rootScope, $compile, $httpBackend) {
element = jqLite("<ng:include src='templateUrl'></ng:include>");
- var log = [];
+ var log = {};
$rootScope.templateUrl = 'myUrl1';
$rootScope.logger = function(msg) {
- log.push(msg);
+ log[msg] = true;
}
$compile(element)($rootScope);
- expect(log.join('; ')).toEqual('');
+ expect(log).toEqual({});
$httpBackend.expect('GET', 'myUrl1').respond('<div>{{logger("url1")}}</div>');
$rootScope.$digest();
- expect(log.join('; ')).toEqual('');
+ expect(log).toEqual({});
$rootScope.templateUrl = 'myUrl2';
$httpBackend.expect('GET', 'myUrl2').respond('<div>{{logger("url2")}}</div>');
- $rootScope.$digest();
$httpBackend.flush(); // now that we have two requests pending, flush!
- expect(log.join('; ')).toEqual('url2; url2'); // it's here twice because we go through at
- // least two digest cycles
+ expect(log).toEqual({ url2 : true });
}));