fix(ngMock): attach $injector to $rootElement

Fixes #14022

Closes #14034
This commit is contained in:
Georgios Kalpakas
2016-02-13 23:33:28 +02:00
parent 3940edced4
commit 88bb5518eb
2 changed files with 7 additions and 3 deletions
+3 -3
View File
@@ -2089,9 +2089,9 @@ angular.mock.$RAFDecorator = ['$delegate', function($delegate) {
*
*/
angular.mock.$RootElementProvider = function() {
this.$get = function() {
return angular.element('<div ng-app></div>');
};
this.$get = ['$injector', function($injector) {
return angular.element('<div ng-app></div>').data('$injector', $injector);
}];
};
/**
+4
View File
@@ -1647,6 +1647,10 @@ describe('ngMock', function() {
it('should create mock application root', inject(function($rootElement) {
expect($rootElement.text()).toEqual('');
}));
it('should attach the `$injector` to `$rootElement`', inject(function($injector, $rootElement) {
expect($rootElement.injector()).toBe($injector);
}));
});