aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMisko Hevery2010-12-08 16:52:08 -0800
committerIgor Minar2011-01-04 16:40:40 -0800
commitd0270d92568e1b7c762b42a0ee0712b65d9acc5c (patch)
tree2a0f0680e6f9713c8c7a2c01d50e7a97d8b01d11 /test
parent5f080193cbc0d84676cf267adcdc6307fb601610 (diff)
downloadangular.js-d0270d92568e1b7c762b42a0ee0712b65d9acc5c.tar.bz2
Remove many eager-publish services, lazy polling
- Browser now starts the poller on first call to addPollFn() - Many services ($location, $cookies, $router) are no longer eager-publish. The result is that unless someone needs the $cookies, they will not cause the Browser to start polling for them.
Diffstat (limited to 'test')
-rw-r--r--test/ScenarioSpec.js4
-rw-r--r--test/servicesSpec.js4
2 files changed, 6 insertions, 2 deletions
diff --git a/test/ScenarioSpec.js b/test/ScenarioSpec.js
index 4a8b5e69..ec016635 100644
--- a/test/ScenarioSpec.js
+++ b/test/ScenarioSpec.js
@@ -42,7 +42,7 @@ describe("ScenarioSpec: Compilation", function(){
it("should have $ objects", function(){
scope = compile('<div></div>', {$config: {a:"b"}});
- expect(scope.$get('$location')).toBeDefined();
+ expect(scope.$inject('$location')).toBeDefined();
expect(scope.$get('$eval')).toBeDefined();
expect(scope.$get('$config')).toBeDefined();
expect(scope.$get('$config.a')).toEqual("b");
@@ -53,7 +53,7 @@ describe("ScenarioSpec: Compilation", function(){
it("should take location object", function(){
var url = "http://server/#?book=moby";
scope = compile("<div>{{$location}}</div>");
- var $location = scope.$location;
+ var $location = scope.$inject('$location');
var $browser = scope.$inject('$browser');
expect($location.hashSearch.book).toBeUndefined();
$browser.setUrl(url);
diff --git a/test/servicesSpec.js b/test/servicesSpec.js
index bda7b47c..014acae4 100644
--- a/test/servicesSpec.js
+++ b/test/servicesSpec.js
@@ -14,6 +14,7 @@ describe("service", function(){
$xhrBulk = scope.$inject('$xhr.bulk');
$xhr = scope.$inject('$xhr');
$route = scope.$inject('$route');
+ scope.$location = inject('$location');
});
afterEach(function(){
@@ -202,6 +203,7 @@ describe("service", function(){
it('should update hash before any processing', function(){
scope = compile('<div>');
+ scope.$location = scope.$inject('$location');
var log = '';
scope.$watch('$location.hash', function(){
log += this.$location.hashPath + ';';
@@ -291,6 +293,7 @@ describe("service", function(){
this.log = '<init>';
}
scope = compile('<div></div>').$init();
+ scope.$location = scope.$inject('$location');
$route = scope.$inject('$route');
$route.when('/Book/:book/Chapter/:chapter', {controller: BookChapter, template:'Chapter.html'});
$route.when('/Blank');
@@ -604,6 +607,7 @@ describe("service", function(){
$browser = new MockBrowser();
$browser.cookieHash['preexisting'] = 'oldCookie';
scope = createScope(null, angularService, {$browser: $browser});
+ scope.$cookies = scope.$inject('$cookies');
});