2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
2016-09-27 17:12:25 -07:00
|
|
|
import {APP_ID, NgModule, NgZone, PLATFORM_INITIALIZER, PlatformRef, Provider, createPlatformFactory, platformCore} from '@angular/core';
|
2016-08-30 18:07:40 -07:00
|
|
|
import {AnimationDriver, BrowserModule} from '@angular/platform-browser';
|
2016-06-08 16:38:52 -07:00
|
|
|
|
2016-08-22 17:37:48 -07:00
|
|
|
import {BrowserDetection, createNgZone} from './browser_util';
|
2016-08-30 18:07:40 -07:00
|
|
|
import {BrowserDomAdapter, ELEMENT_PROBE_PROVIDERS} from './private_import_platform-browser';
|
2016-06-08 16:38:52 -07:00
|
|
|
|
2016-06-10 10:21:53 -07:00
|
|
|
function initBrowserTests() {
|
|
|
|
|
BrowserDomAdapter.makeCurrent();
|
|
|
|
|
BrowserDetection.setup();
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-15 19:37:42 -07:00
|
|
|
const _TEST_BROWSER_PLATFORM_PROVIDERS: Provider[] =
|
2016-07-18 03:50:31 -07:00
|
|
|
[{provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true}];
|
|
|
|
|
|
2016-04-28 17:50:03 -07:00
|
|
|
/**
|
2016-07-04 09:37:30 -07:00
|
|
|
* Platform for testing
|
2016-06-27 12:27:23 -07:00
|
|
|
*
|
2016-08-23 15:41:05 -07:00
|
|
|
* @stable
|
2016-04-28 17:50:03 -07:00
|
|
|
*/
|
2016-07-26 05:21:19 -07:00
|
|
|
export const platformBrowserTesting =
|
|
|
|
|
createPlatformFactory(platformCore, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);
|
|
|
|
|
|
2016-06-10 10:21:53 -07:00
|
|
|
/**
|
2016-07-18 03:50:31 -07:00
|
|
|
* NgModule for testing.
|
2016-06-27 12:27:23 -07:00
|
|
|
*
|
2016-08-23 15:41:05 -07:00
|
|
|
* @stable
|
2016-06-10 10:21:53 -07:00
|
|
|
*/
|
2016-07-18 03:50:31 -07:00
|
|
|
@NgModule({
|
|
|
|
|
exports: [BrowserModule],
|
2016-07-04 09:37:30 -07:00
|
|
|
providers: [
|
|
|
|
|
{provide: APP_ID, useValue: 'a'}, ELEMENT_PROBE_PROVIDERS,
|
|
|
|
|
{provide: NgZone, useFactory: createNgZone},
|
|
|
|
|
{provide: AnimationDriver, useValue: AnimationDriver.NOOP}
|
|
|
|
|
]
|
|
|
|
|
})
|
2016-07-18 03:50:31 -07:00
|
|
|
export class BrowserTestingModule {
|
2016-07-04 09:37:30 -07:00
|
|
|
}
|