fix(ngMock): attach $injector to $rootElement
Fixes #14022 Closes #14034
This commit is contained in:
Vendored
+3
-3
@@ -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);
|
||||
}];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+4
@@ -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);
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user