refactor(core): change bootstrap of modules and names of platforms

BREAKING CHANGES:
- `browserPlatform`/`browserDynamicPlatform`/... have been deprecated and renamed into `platformBrowser`/`platformBrowserDynamic`/....
- `bootstrapModule` and `bootstrapModuleFactory` have been moved to be members of `PlaformRef`.
  E.g. `platformBrowserDynamic().bootstrapModule(MyModule)`.
This commit is contained in:
Tobias Bosch
2016-07-26 05:21:19 -07:00
parent 00b726f695
commit 5a21f168d6
27 changed files with 219 additions and 163 deletions

View File

@ -7,13 +7,12 @@
*/
import {CompilerConfig, DirectiveResolver, NgModuleResolver, ViewResolver, analyzeAppProvidersForDeprecatedConfiguration} from '@angular/compiler';
import {OverridingTestComponentBuilder, coreDynamicTestingPlatform} from '@angular/compiler/testing';
import {OverridingTestComponentBuilder, platformCoreDynamicTesting} from '@angular/compiler/testing';
import {Compiler, CompilerFactory, CompilerOptions, NgModule, PlatformRef, Provider, ReflectiveInjector, Type, createPlatform, createPlatformFactory} from '@angular/core';
import {TestComponentBuilder, TestComponentRenderer, initTestEnvironment} from '@angular/core/testing';
import {BrowserTestingModule, browserTestingPlatform} from '@angular/platform-browser/testing';
import {BrowserTestingModule, platformBrowserTesting} from '@angular/platform-browser/testing';
import {Console} from './core_private';
import {browserDynamicPlatform} from './index';
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers';
import {DOMTestComponentRenderer} from './testing/dom_test_component_renderer';
@ -22,10 +21,15 @@ export * from './private_export_testing'
/**
* @experimental API related to bootstrapping are still under review.
*/
export const browserDynamicTestingPlatform = createPlatformFactory(
coreDynamicTestingPlatform, 'browserDynamicTesting',
export const platformBrowserDynamicTesting = createPlatformFactory(
platformCoreDynamicTesting, 'browserDynamicTesting',
INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
/**
* @deprecated Use {@link platformBrowserDynamicTesting} instead
*/
export const browserDynamicTestingPlatform = platformBrowserDynamicTesting;
/**
* NgModule for testing.
*
@ -50,7 +54,7 @@ export const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: Array<any /*Type | Provide
[(appProviders: any[]) => {
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(appProviders);
const platformRef =
createPlatformFactory(browserDynamicTestingPlatform, 'browserDynamicTestingDeprecated', [{
createPlatformFactory(platformBrowserDynamicTesting, 'browserDynamicTestingDeprecated', [{
provide: CompilerOptions,
useValue: deprecatedConfiguration.compilerOptions,
multi: true