diff options
| author | Misko Hevery | 2012-05-18 14:53:11 -0700 |
|---|---|---|
| committer | Misko Hevery | 2012-06-02 14:50:58 -0700 |
| commit | 85632cb44c95617d73c369f3a03fb476a4d5c8a2 (patch) | |
| tree | a8c8b7e60d289362a8894bdc7af9dc7111f9d249 /test | |
| parent | 0a6e464a93d9a1e76a624b356054ce9ca4015f55 (diff) | |
| download | angular.js-85632cb44c95617d73c369f3a03fb476a4d5c8a2.tar.bz2 | |
feat($rootElement): added application root element
Publish the application root element as $rootElement
so that it can be injected to other services.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/rootElementSpec.js | 12 | ||||
| -rw-r--r-- | test/ngMock/angular-mocksSpec.js | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/ng/rootElementSpec.js b/test/ng/rootElementSpec.js new file mode 100644 index 00000000..81272093 --- /dev/null +++ b/test/ng/rootElementSpec.js @@ -0,0 +1,12 @@ +'use strict'; + +describe('$rootElement', function() { + it('should publish the bootstrap element into $rootElement', function() { + var element = jqLite('<div></div>'); + var injector = angular.bootstrap(element); + + expect(injector.get('$rootElement')[0]).toBe(element[0]); + + dealoc(element); + }); +}); diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js index 62190072..f4f6a346 100644 --- a/test/ngMock/angular-mocksSpec.js +++ b/test/ngMock/angular-mocksSpec.js @@ -950,6 +950,13 @@ describe('ngMock', function() { }); }); }); + + + describe('$rootElement', function() { + it('should create mock application root', inject(function($rootElement) { + expect($rootElement.text()).toEqual(''); + })); + }); }); |
