Permalink
Browse files

fix(platform-browser): provide Title service as part of the module (#…

  • Loading branch information...
pkozlowski-opensource authored and alexeagle committed Sep 14, 2016
1 parent 0a2132e commit 85d9db6bc4ca6b5229e60aafa8eec648e8fe9f9e
@@ -15,6 +15,7 @@ import {WebAnimationsDriver} from '../src/dom/web_animations_driver';
import {BrowserDomAdapter} from './browser/browser_adapter';
import {BrowserPlatformLocation} from './browser/location/browser_platform_location';
import {BrowserGetTestability} from './browser/testability';
+import {Title} from './browser/title';
import {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
import {getDOM} from './dom/dom_adapter';
import {DomRootRenderer, DomRootRenderer_} from './dom/dom_renderer';
@@ -85,7 +86,7 @@ export function _resolveDefaultAnimationDriver(): AnimationDriver {
{provide: RootRenderer, useExisting: DomRootRenderer},
{provide: SharedStylesHost, useExisting: DomSharedStylesHost},
{provide: AnimationDriver, useFactory: _resolveDefaultAnimationDriver}, DomSharedStylesHost,
- Testability, EventManager, ELEMENT_PROBE_PROVIDERS
+ Testability, EventManager, ELEMENT_PROBE_PROVIDERS, Title
],
exports: [CommonModule, ApplicationModule]
})
@@ -6,8 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/
-import {Title} from '@angular/platform-browser';
+import {Injectable} from '@angular/core';
+import {TestBed} from '@angular/core/testing';
+import {BrowserModule, Title} from '@angular/platform-browser';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
+import {expect} from '@angular/platform-browser/testing/matchers';
export function main() {
describe('title service', () => {
@@ -29,6 +32,23 @@ export function main() {
titleService.setTitle(null);
expect(getDOM().getTitle()).toEqual('');
});
+ });
+
+ describe('integration test', () => {
+
+ @Injectable()
+ class DependsOnTitle {
+ constructor(public title: Title) {}
+ }
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ imports: [BrowserModule],
+ providers: [DependsOnTitle],
+ });
+ });
+ it('should inject Title service when using BrowserModule',
+ () => { expect(TestBed.get(DependsOnTitle).title).toBeAnInstanceOf(Title); });
});
}

0 comments on commit 85d9db6

Please sign in to comment.