Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Sep 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/@angular/platform-browser/src/browser.ts
Expand Up @@ -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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is Title (TS) exported ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
import {getDOM} from './dom/dom_adapter';
import {DomRootRenderer, DomRootRenderer_} from './dom/dom_renderer';
Expand Down Expand Up @@ -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]
})
Expand Down
22 changes: 21 additions & 1 deletion modules/@angular/platform-browser/test/browser/title_spec.ts
Expand Up @@ -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', () => {
Expand All @@ -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); });
});
}