From 85632cb44c95617d73c369f3a03fb476a4d5c8a2 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 18 May 2012 14:53:11 -0700 Subject: feat($rootElement): added application root element Publish the application root element as $rootElement so that it can be injected to other services. --- test/ng/rootElementSpec.js | 12 ++++++++++++ test/ngMock/angular-mocksSpec.js | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 test/ng/rootElementSpec.js (limited to 'test') 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('
'); + 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(''); + })); + }); }); -- cgit v1.2.3