diff options
| author | Misko Hevery | 2011-11-02 16:32:46 -0700 |
|---|---|---|
| committer | Misko Hevery | 2011-11-14 16:39:33 -0800 |
| commit | bd04316a89a0909e7a4e483839d573ce857f7622 (patch) | |
| tree | 0378c33976ba524b7090a3665cd7729638f1545e /test | |
| parent | ed36b9da3be338fe9eb36f3eeea901d6f51cd768 (diff) | |
| download | angular.js-bd04316a89a0909e7a4e483839d573ce857f7622.tar.bz2 | |
refactor(services): migrate angular.service -> module
Diffstat (limited to 'test')
| -rw-r--r-- | test/AngularSpec.js | 19 | ||||
| -rw-r--r-- | test/BinderSpec.js | 16 | ||||
| -rw-r--r-- | test/FiltersSpec.js | 8 | ||||
| -rw-r--r-- | test/InjectorSpec.js | 6 | ||||
| -rw-r--r-- | test/angular-mocksSpec.js | 113 | ||||
| -rw-r--r-- | test/mocks.js | 69 | ||||
| -rw-r--r-- | test/service/cookiesSpec.js | 2 | ||||
| -rw-r--r-- | test/service/exceptionHandlerSpec.js | 4 | ||||
| -rw-r--r-- | test/service/localeSpec.js | 2 | ||||
| -rw-r--r-- | test/service/logSpec.js | 4 | ||||
| -rw-r--r-- | test/service/scopeSpec.js | 12 | ||||
| -rw-r--r-- | test/service/snifferSpec.js | 2 | ||||
| -rw-r--r-- | test/testabilityPatch.js | 29 | ||||
| -rw-r--r-- | test/widget/inputSpec.js | 6 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 8 |
15 files changed, 123 insertions, 177 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 8902c2a9..6229120d 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -382,25 +382,6 @@ describe('angular', function() { expect(fake).toEqual('new'); })); - it('should not preserve properties on override', function() { - angular.service('fake', {$one: true}, {$two: true}, {three: true}); - var result = angular.service('fake', {$four: true}); - - expect(result.$one).toBeUndefined(); - expect(result.$two).toBeUndefined(); - expect(result.three).toBeUndefined(); - expect(result.$four).toBe(true); - }); - - it('should not preserve non-angular properties on override', function() { - angular.service('fake', {one: true}, {two: true}); - var result = angular.service('fake', {third: true}); - - expect(result.one).not.toBeDefined(); - expect(result.two).not.toBeDefined(); - expect(result.third).toBeTruthy(); - }); - it('should inject dependencies specified by $inject and ignore function argument name', function() { expect(angular.injector(function($provide){ $provide.factory('svc1', function() { return 'svc1'; }); diff --git a/test/BinderSpec.js b/test/BinderSpec.js index 495d98a8..6ab94401 100644 --- a/test/BinderSpec.js +++ b/test/BinderSpec.js @@ -222,8 +222,8 @@ describe('Binder', function() { })); it('IfTextBindingThrowsErrorDecorateTheSpan', inject( - function($provide){ - $provide.factory('$exceptionHandler', $exceptionHandlerMockFactory); + function($exceptionHandlerProvider){ + $exceptionHandlerProvider.mode('log'); }, function($rootScope, $exceptionHandler, $compile) { $compile('<div>{{error.throw()}}</div>', null, true)($rootScope); @@ -245,8 +245,8 @@ describe('Binder', function() { }) ); - it('IfAttrBindingThrowsErrorDecorateTheAttribute', inject(function($provide){ - $provide.factory('$exceptionHandler', $exceptionHandlerMockFactory); + it('IfAttrBindingThrowsErrorDecorateTheAttribute', inject(function($exceptionHandlerProvider){ + $exceptionHandlerProvider.mode('log'); }, function($rootScope, $exceptionHandler, $compile) { $compile('<div attr="before {{error.throw()}} after"></div>', null, true)($rootScope); var errorLogs = $exceptionHandler.errors; @@ -387,8 +387,8 @@ describe('Binder', function() { })); it('ActionOnAHrefThrowsError', inject( - function($provide){ - $provide.factory('$exceptionHandler', $exceptionHandlerMockFactory); + function($exceptionHandlerProvider){ + $exceptionHandlerProvider.mode('log'); }, function($rootScope, $exceptionHandler, $compile) { var input = $compile('<a ng:click="action()">Add Phone</a>')($rootScope); @@ -471,8 +471,8 @@ describe('Binder', function() { })); it('ItShouldDisplayErrorWhenActionIsSyntacticlyIncorrect', inject( - function($provide){ - $provide.factory('$exceptionHandler', $exceptionHandlerMockFactory); + function($exceptionHandlerProvider){ + $exceptionHandlerProvider.mode('log'); }, function($rootScope, $exceptionHandler, $log, $compile) { var element = $compile( diff --git a/test/FiltersSpec.js b/test/FiltersSpec.js index 4b69bf03..8c567441 100644 --- a/test/FiltersSpec.js +++ b/test/FiltersSpec.js @@ -200,10 +200,10 @@ describe('filter', function() { describe('date', function() { - var morning = new TzDate(+5, '2010-09-03T12:05:08.000Z'); //7am - var noon = new TzDate(+5, '2010-09-03T17:05:08.000Z'); //12pm - var midnight = new TzDate(+5, '2010-09-03T05:05:08.000Z'); //12am - var earlyDate = new TzDate(+5, '0001-09-03T05:05:08.000Z'); + var morning = new angular.mock.TzDate(+5, '2010-09-03T12:05:08.000Z'); //7am + var noon = new angular.mock.TzDate(+5, '2010-09-03T17:05:08.000Z'); //12pm + var midnight = new angular.mock.TzDate(+5, '2010-09-03T05:05:08.000Z'); //12am + var earlyDate = new angular.mock.TzDate(+5, '0001-09-03T05:05:08.000Z'); var context, date; diff --git a/test/InjectorSpec.js b/test/InjectorSpec.js index 3ba819b8..ac412c39 100644 --- a/test/InjectorSpec.js +++ b/test/InjectorSpec.js @@ -239,6 +239,12 @@ describe('injector', function() { expect($injector('a')).toEqual('abc'); }); + it('should error on invalid madule name', function(){ + expect(function(){ + createInjector(['IDontExist'], {}); + }).toThrow("Module 'IDontExist' is not defined!"); + }); + describe('$provide', function() { describe('value', function(){ diff --git a/test/angular-mocksSpec.js b/test/angular-mocksSpec.js index 205461af..343be966 100644 --- a/test/angular-mocksSpec.js +++ b/test/angular-mocksSpec.js @@ -8,90 +8,90 @@ describe('mocks', function() { } it('should take millis as constructor argument', function() { - expect(new TzDate(0, 0).getTime()).toBe(0); - expect(new TzDate(0, 1283555108000).getTime()).toBe(1283555108000); + expect(new angular.mock.TzDate(0, 0).getTime()).toBe(0); + expect(new angular.mock.TzDate(0, 1283555108000).getTime()).toBe(1283555108000); }); it('should take dateString as constructor argument', function() { - expect(new TzDate(0, '1970-01-01T00:00:00.000Z').getTime()).toBe(0); - expect(new TzDate(0, '2010-09-03T23:05:08.023Z').getTime()).toBe(1283555108023); + expect(new angular.mock.TzDate(0, '1970-01-01T00:00:00.000Z').getTime()).toBe(0); + expect(new angular.mock.TzDate(0, '2010-09-03T23:05:08.023Z').getTime()).toBe(1283555108023); }); it('should fake getLocalDateString method', function() { //0 in -3h - var t0 = new TzDate(-3, 0); + var t0 = new angular.mock.TzDate(-3, 0); expect(t0.toLocaleDateString()).toMatch('1970'); //0 in +0h - var t1 = new TzDate(0, 0); + var t1 = new angular.mock.TzDate(0, 0); expect(t1.toLocaleDateString()).toMatch('1970'); //0 in +3h - var t2 = new TzDate(3, 0); + var t2 = new angular.mock.TzDate(3, 0); expect(t2.toLocaleDateString()).toMatch('1969'); }); it('should fake getHours method', function() { //0 in -3h - var t0 = new TzDate(-3, 0); + var t0 = new angular.mock.TzDate(-3, 0); expect(t0.getHours()).toBe(3); //0 in +0h - var t1 = new TzDate(0, 0); + var t1 = new angular.mock.TzDate(0, 0); expect(t1.getHours()).toBe(0); //0 in +3h - var t2 = new TzDate(3, 0); + var t2 = new angular.mock.TzDate(3, 0); expect(t2.getHours()).toMatch(21); }); it('should fake getMinutes method', function() { //0:15 in -3h - var t0 = new TzDate(-3, minutes(15)); + var t0 = new angular.mock.TzDate(-3, minutes(15)); expect(t0.getMinutes()).toBe(15); //0:15 in -3.25h - var t0a = new TzDate(-3.25, minutes(15)); + var t0a = new angular.mock.TzDate(-3.25, minutes(15)); expect(t0a.getMinutes()).toBe(30); //0 in +0h - var t1 = new TzDate(0, minutes(0)); + var t1 = new angular.mock.TzDate(0, minutes(0)); expect(t1.getMinutes()).toBe(0); //0:15 in +0h - var t1a = new TzDate(0, minutes(15)); + var t1a = new angular.mock.TzDate(0, minutes(15)); expect(t1a.getMinutes()).toBe(15); //0:15 in +3h - var t2 = new TzDate(3, minutes(15)); + var t2 = new angular.mock.TzDate(3, minutes(15)); expect(t2.getMinutes()).toMatch(15); //0:15 in +3.25h - var t2a = new TzDate(3.25, minutes(15)); + var t2a = new angular.mock.TzDate(3.25, minutes(15)); expect(t2a.getMinutes()).toMatch(0); }); it('should fake getSeconds method', function() { //0 in -3h - var t0 = new TzDate(-3, 0); + var t0 = new angular.mock.TzDate(-3, 0); expect(t0.getSeconds()).toBe(0); //0 in +0h - var t1 = new TzDate(0, 0); + var t1 = new angular.mock.TzDate(0, 0); expect(t1.getSeconds()).toBe(0); //0 in +3h - var t2 = new TzDate(3, 0); + var t2 = new angular.mock.TzDate(3, 0); expect(t2.getSeconds()).toMatch(0); }); it('should create a date representing new year in Bratislava', function() { - var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00.000Z'); + var newYearInBratislava = new angular.mock.TzDate(-1, '2009-12-31T23:00:00.000Z'); expect(newYearInBratislava.getTimezoneOffset()).toBe(-60); expect(newYearInBratislava.getFullYear()).toBe(2010); expect(newYearInBratislava.getMonth()).toBe(0); @@ -103,7 +103,7 @@ describe('mocks', function() { it('should delegate all the UTC methods to the original UTC Date object', function() { //from when created from string - var date1 = new TzDate(-1, '2009-12-31T23:00:00.000Z'); + var date1 = new angular.mock.TzDate(-1, '2009-12-31T23:00:00.000Z'); expect(date1.getUTCFullYear()).toBe(2009); expect(date1.getUTCMonth()).toBe(11); expect(date1.getUTCDate()).toBe(31); @@ -113,7 +113,7 @@ describe('mocks', function() { //from when created from millis - var date2 = new TzDate(-1, angular.String.toDate('2009-12-31T23:00:00.000Z').getTime()); + var date2 = new angular.mock.TzDate(-1, angular.String.toDate('2009-12-31T23:00:00.000Z').getTime()); expect(date2.getUTCFullYear()).toBe(2009); expect(date2.getUTCMonth()).toBe(11); expect(date2.getUTCDate()).toBe(31); @@ -124,16 +124,20 @@ describe('mocks', function() { it('should throw error when no third param but toString called', function() { - expect(function() { new TzDate(0,0).toString(); }). + expect(function() { new angular.mock.TzDate(0,0).toString(); }). toThrow('Method \'toString\' is not implemented in the TzDate mock'); }); }); - describe('$log mock', function() { + describe('$log', function() { var $log; - beforeEach(function() { - $log = MockLogFactory(); - }); + beforeEach(inject(['$log', function(log) { + $log = log; + }])); + + afterEach(inject(function($log){ + $log.reset(); + })); it('should provide log method', function() { expect(function() { $log.log(''); }).not.toThrow(); @@ -170,14 +174,48 @@ describe('mocks', function() { $log.error('fake log'); expect($log.error.logs).toContain(['fake log']); }); + + it('should assertEmpty', function(){ + try { + $log.error(Error('MyError')); + $log.warn(Error('MyWarn')); + $log.info(Error('MyInfo')); + $log.log(Error('MyLog')); + $log.assertEmpty(); + } catch (error) { + error = error.message || error; + expect(error).toMatch(/Error: MyError/m); + expect(error).toMatch(/Error: MyWarn/m); + expect(error).toMatch(/Error: MyInfo/m); + expect(error).toMatch(/Error: MyLog/m); + } finally { + $log.reset(); + } + }); + + it('should reset state', function(){ + $log.error(Error('MyError')); + $log.warn(Error('MyWarn')); + $log.info(Error('MyInfo')); + $log.log(Error('MyLog')); + $log.reset(); + var passed = false; + try { + $log.assertEmpty(); // should not throw error! + passed = true; + } catch (e) { + passed = e; + } + expect(passed).toBe(true); + }); }); describe('defer', function() { var browser, log; - beforeEach(function() { - browser = new MockBrowser(); + beforeEach(inject(function($browser) { + browser = $browser; log = ''; - }); + })); function logFn(text){ return function() { log += text +';'; @@ -229,5 +267,20 @@ describe('mocks', function() { it('should rethrow exceptions', inject(function($exceptionHandler) { expect(function() { $exceptionHandler('myException'); }).toThrow('myException'); })); + + + it('should log exceptions', inject(function($exceptionHandlerProvider){ + $exceptionHandlerProvider.mode('log'); + var $exceptionHandler = $exceptionHandlerProvider.$get(); + $exceptionHandler('MyError'); + expect($exceptionHandler.errors).toEqual(['MyError']); + })); + + + it('should thorw on wrong argument', inject(function($exceptionHandlerProvider) { + expect(function() { + $exceptionHandlerProvider.mode('XXX'); + }).toThrow("Unknown mode 'XXX', only 'log'/'rethrow' modes are allowed!"); + })); }); }); diff --git a/test/mocks.js b/test/mocks.js deleted file mode 100644 index da0449ac..00000000 --- a/test/mocks.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -/** - * Mock implementation of {@link angular.service.$log} that gathers all logged messages in arrays - * (one array per logging level). These arrays are exposed as `logs` property of each of the - * level-specific log function, e.g. for level `error` the array is exposed as - * `$logMock.error.logs` - * - * Please note that this is not a factory function, but rather the actual mock instance. This is - * important because it allows `beforeEach` and `afterEach` test hooks to clean up or check the - * state of `logs` arrays in between tests. - * - * Exposing the instance in this way makes this mock a singleton, which means that the instance - * becomes global state for tests. To mitigate the issue, each time the `$log` mock is registered - * with the injector, a check is performed to ensure that there are no pending logs in `logs` - * arrays. This means that if a message is logged via $log during a test, the `logs` array must be - * emptied before the test is finished. `Array#shift` method can be used for this purpose as - * follows: - * - * <pre> - * it('should do some good', function() { - * var scope = angular.scope(), - * $log = scope.$service('$log'); - * - * //do something that triggers a message to be logged - * expect($log.error.logs.shift()).toEqual(['message', 'arg1', 'arg2']); - * }); - * </pre> - * - * See {@link angular.mock} for more info on angular mocks. - */ -var $logMock = { - log: function() { $logMock.log.logs.push(concat([], arguments, 0)); }, - warn: function() { $logMock.warn.logs.push(concat([], arguments, 0)); }, - info: function() { $logMock.info.logs.push(concat([], arguments, 0)); }, - error: function() { $logMock.error.logs.push(concat([], arguments, 0)); } -}; -$logMock.log.logs = []; -$logMock.warn.logs = []; -$logMock.info.logs = []; -$logMock.error.logs = []; - -angular.service('$log', function() { - return $logMock; -}); - - -/** - * Factory that returns mock implementation of {@link angular.service.$exceptionHandler} that - * gathers all errors in an array. This array is exposed as `errors` property of the mock and can be - * accessed as `$exceptionHandler.errors`. - * - * Note that this factory is not registered with angular's injector by default (as opposed to - * `$logMock`). It is your responsibility to register this factory when you need it. Typically like - * this: - * - * <pre> - * var scope = angular.scope(null, {'$exceptionHandler': $exceptionHandlerMockFactory()}); - * </pre> - * - */ -function $exceptionHandlerMockFactory() { - var mockHandler = function(e) { - mockHandler.errors.push(e); - }; - mockHandler.errors = []; - - return mockHandler; -} diff --git a/test/service/cookiesSpec.js b/test/service/cookiesSpec.js index 66bdc504..d73923a6 100644 --- a/test/service/cookiesSpec.js +++ b/test/service/cookiesSpec.js @@ -3,7 +3,7 @@ describe('$cookies', function() { beforeEach(inject(function($provide) { $provide.factory('$browser', function(){ - return angular.extend(new MockBrowser(), {cookieHash: {preexisting:'oldCookie'}}); + return angular.extend(new angular.mock.$Browser(), {cookieHash: {preexisting:'oldCookie'}}); }); })); diff --git a/test/service/exceptionHandlerSpec.js b/test/service/exceptionHandlerSpec.js index 821ad7b8..00abff30 100644 --- a/test/service/exceptionHandlerSpec.js +++ b/test/service/exceptionHandlerSpec.js @@ -5,11 +5,9 @@ describe('$exceptionHandler', function() { it('should log errors', inject( function($provide){ - $provide.factory('$exceptionHandler', $exceptionHandlerFactory); - $provide.value('$log', $logMock); + $provide.service('$exceptionHandler', $ExceptionHandlerProvider); }, function($log, $exceptionHandler) { - $log.error.rethrow = false; $exceptionHandler('myError'); expect($log.error.logs.shift()).toEqual(['myError']); } diff --git a/test/service/localeSpec.js b/test/service/localeSpec.js index 86bc7b0e..83c4ecee 100644 --- a/test/service/localeSpec.js +++ b/test/service/localeSpec.js @@ -2,7 +2,7 @@ describe('$locale', function() { - var $locale = angular.service('$locale')(); + var $locale = new $LocaleProvider().$get(); it('should have locale id set to en-us', function() { expect($locale.id).toBe('en-us'); diff --git a/test/service/logSpec.js b/test/service/logSpec.js index 3b860756..93e705a9 100644 --- a/test/service/logSpec.js +++ b/test/service/logSpec.js @@ -12,7 +12,7 @@ describe('$log', function() { beforeEach(inject(function($provide){ $window = {}; logger = ''; - $provide.factory('$log', $logFactory); + $provide.service('$log', $LogProvider); $provide.value('$exceptionHandler', rethrow); $provide.value('$window', $window); })); @@ -68,7 +68,7 @@ describe('$log', function() { e.line = undefined; e.stack = undefined; - $log = $logFactory({console:{error:function() { + $log = new $LogProvider().$get[1]({console:{error:function() { errorArgs = arguments; }}}); }); diff --git a/test/service/scopeSpec.js b/test/service/scopeSpec.js index b7f50edb..88824fcd 100644 --- a/test/service/scopeSpec.js +++ b/test/service/scopeSpec.js @@ -2,8 +2,8 @@ describe('Scope', function() { - beforeEach(inject(function($provide) { - $provide.factory('$exceptionHandler', $exceptionHandlerMockFactory); + beforeEach(inject(function($exceptionHandlerProvider) { + $exceptionHandlerProvider.mode('log'); })); @@ -121,12 +121,12 @@ describe('Scope', function() { expect(spy).wasCalled(); })); - it('should delegate exceptions', inject(function($rootScope, $exceptionHandler) { + it('should delegate exceptions', inject(function($rootScope, $exceptionHandler, $log) { $rootScope.$watch('a', function() {throw new Error('abc');}); $rootScope.a = 1; $rootScope.$digest(); expect($exceptionHandler.errors[0].message).toEqual('abc'); - $logMock.error.logs.length = 0; + $log.assertEmpty(); })); @@ -422,7 +422,7 @@ describe('Scope', function() { })); - it('should catch exceptions', inject(function($rootScope, $exceptionHandler) { + it('should catch exceptions', inject(function($rootScope, $exceptionHandler, $log) { var log = ''; var child = $rootScope.$new(); $rootScope.$watch('a', function(scope, a){ log += '1'; }); @@ -430,7 +430,7 @@ describe('Scope', function() { child.$apply(function() { throw new Error('MyError'); }); expect(log).toEqual('1'); expect($exceptionHandler.errors[0].message).toEqual('MyError'); - $logMock.error.logs.shift(); + $log.error.logs.shift(); })); diff --git a/test/service/snifferSpec.js b/test/service/snifferSpec.js index 72c32046..7ec1dc8d 100644 --- a/test/service/snifferSpec.js +++ b/test/service/snifferSpec.js @@ -3,7 +3,7 @@ describe('$sniffer', function() { function sniffer($window) { - return angular.service('$sniffer')($window); + return new $SnifferProvider().$get[1]($window); } describe('history', function() { diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index eb98cb6f..4d576ab9 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -77,18 +77,13 @@ beforeEach(function() { } }); - $logMock.log.logs = []; - $logMock.warn.logs = []; - $logMock.info.logs = []; - $logMock.error.logs = []; - }); function inject(){ var blockFns = sliceArgs(arguments); return function(){ var spec = this; - spec.$injector = spec.$injector || angular.injector('NG'); + spec.$injector = spec.$injector || angular.injector('NG', 'NG_MOCK'); angular.forEach(blockFns, function(fn){ spec.$injector.invoke(spec, fn); }); @@ -96,30 +91,12 @@ function inject(){ } -afterEach(inject(function($rootScope) { +afterEach(inject(function($rootScope, $log) { // release the injector dealoc($rootScope); // check $log mock - forEach(['error', 'warn', 'info', 'log'], function(logLevel) { - if ($logMock[logLevel].logs.length) { - forEach($logMock[logLevel].logs, function(log) { - forEach(log, function deleteStack(logItem) { - if (logItem instanceof Error) { - dump(logItem.stack); - delete logItem.stack; - delete logItem.arguments; - } else { - dump(logItem); - } - }); - }); - - throw new Error("Exprected $log." + logLevel + ".logs array to be empty. " + - "Either a message was logged unexpectedly, or an expected log message was not checked " + - "and removed. Array contents: " + toJson($logMock[logLevel].logs)); - } - }); + $log.assertEmpty && $log.assertEmpty(); clearJqCache(); })); diff --git a/test/widget/inputSpec.js b/test/widget/inputSpec.js index 8d409b25..cd70cea4 100644 --- a/test/widget/inputSpec.js +++ b/test/widget/inputSpec.js @@ -448,12 +448,12 @@ describe('widget: input', function() { }); - it('should report error on assignment error', function() { + it('should report error on assignment error', inject(function($log) { expect(function() { compile('<input type="text" ng:model="throw \'\'">'); }).toThrow("Syntax Error: Token '''' is an unexpected token at column 7 of the expression [throw ''] starting at ['']."); - $logMock.error.logs.shift(); - }); + $log.error.logs.shift(); + })); }); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index ef28ea77..fc898f83 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -223,12 +223,12 @@ describe("widget", function() { expect(element.text()).toEqual('name:value;'); })); - it('should error on wrong parsing of ng:repeat', inject(function($rootScope, $compile) { + it('should error on wrong parsing of ng:repeat', inject(function($rootScope, $compile, $log) { expect(function() { var element = $compile('<ul><li ng:repeat="i dont parse"></li></ul>')($rootScope); }).toThrow("Expected ng:repeat in form of '_item_ in _collection_' but got 'i dont parse'."); - $logMock.error.logs.shift(); + $log.error.logs.shift(); })); it('should expose iterator offset as $index when iterating over arrays', inject(function($rootScope, $compile) { @@ -487,9 +487,9 @@ describe("widget", function() { })); it('should be possible to nest ng:view in ng:include', inject(function() { - var injector = angular.injector('NG'); + var injector = angular.injector('NG', 'NG_MOCK'); var myApp = injector('$rootScope'); - var $browser = myApp.$service('$browser'); + var $browser = injector('$browser'); $browser.xhr.expectGET('includePartial.html').respond('view: <ng:view></ng:view>'); injector('$location').path('/foo'); |
