fix: public api surface fixes + stability markers

- ts-api-guardian will now error if a new public symbol is added with a stability marker (`@stable`, `@experimental`, `@deprecated`)
- DomEventsPlugin and KeyEventsPlugin were removed from public api surface - these classes is an implementation detail
- deprecated BROWSER_PROVIDERS was removed completely
- `@angular/compiler` was removed from the ts-api-guardian check since this package shouldn't contain anything that users need to directly import
- the rest of the api surface was conservatively marked as stable or experimental

BREAKING CHANGES: DomEventsPlugin and KeyEventsPlugin previously exported from core are no longer public - these classes are implementation detail.

Previously deprecated BROWSER_PROVIDERS was completely removed from platform-browser.

Closes #9236
Closes #9235
Ref #9234
This commit is contained in:
Igor Minar
2016-06-27 12:27:23 -07:00
parent fcfddbf79c
commit 24eb8389d2
102 changed files with 685 additions and 103 deletions

View File

@ -24,6 +24,8 @@ var _global = <any>(typeof window === 'undefined' ? global : window);
* })
* });
* ```
*
* @stable
*/
export function async(fn: Function): (done: any) => any {
// If we're running using the Jasmine test framework, adapt to call the 'done'

View File

@ -16,6 +16,8 @@ import {tick} from './fake_async';
/**
* Fixture for debugging and testing a component.
*
* @stable
*/
export class ComponentFixture<T> {
/**

View File

@ -25,6 +25,8 @@ let _FakeAsyncTestZoneSpecType = (Zone as any /** TODO #9100 */)['FakeAsyncTestZ
*
* @param fn
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
*
* @experimental
*/
export function fakeAsync(fn: Function): (...args: any[]) => any {
if (Zone.current.get('FakeAsyncTestZoneSpec') != null) {
@ -73,6 +75,7 @@ function _getFakeAsyncZoneSpec(): any {
*
* {@example testing/ts/fake_async.ts region='basic'}
*
* @experimental
*/
export function tick(millis: number = 0): void {
_getFakeAsyncZoneSpec().tick(millis);
@ -80,6 +83,8 @@ export function tick(millis: number = 0): void {
/**
* Discard all remaining periodic tasks.
*
* @experimental
*/
export function discardPeriodicTasks(): void {
let zoneSpec = _getFakeAsyncZoneSpec();
@ -89,6 +94,8 @@ export function discardPeriodicTasks(): void {
/**
* Flush any pending microtasks.
*
* @experimental
*/
export function flushMicrotasks(): void {
_getFakeAsyncZoneSpec().flushMicrotasks();

View File

@ -16,18 +16,28 @@ import {tick} from './fake_async';
/**
* An abstract class for inserting the root test component element in a platform independent way.
*
* @experimental
*/
export class TestComponentRenderer {
insertRootElement(rootElementId: string) {}
}
/**
* @experimental
*/
export var ComponentFixtureAutoDetect = new OpaqueToken('ComponentFixtureAutoDetect');
/**
* @experimental
*/
export var ComponentFixtureNoNgZone = new OpaqueToken('ComponentFixtureNoNgZone');
var _nextRootElementId = 0;
/**
* Builds a ComponentFixture for use in component level tests.
* @stable
*/
@Injectable()
export class TestComponentBuilder {

View File

@ -13,6 +13,9 @@ import {BaseException} from '../src/facade/exceptions';
import {FunctionWrapper, isPresent} from '../src/facade/lang';
import {AsyncTestCompleter} from './async_test_completer';
/**
* @experimental
*/
export class TestInjector {
private _instantiated: boolean = false;
@ -64,6 +67,9 @@ export class TestInjector {
var _testInjector: TestInjector = null;
/**
* @experimental
*/
export function getTestInjector() {
if (_testInjector == null) {
_testInjector = new TestInjector();
@ -81,6 +87,8 @@ export function getTestInjector() {
*
* Test Providers for individual platforms are available from
* 'angular2/platform/testing/<platform_name>'.
*
* @experimental
*/
export function setBaseTestProviders(
platformProviders: Array<Type|Provider|any[]>,
@ -101,6 +109,8 @@ export function setBaseTestProviders(
/**
* Reset the providers for the test injector.
*
* @experimental
*/
export function resetBaseTestProviders() {
var testInjector = getTestInjector();
@ -131,6 +141,7 @@ export function resetBaseTestProviders() {
* eventually
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
*
* @stable
*/
export function inject(tokens: any[], fn: Function): () => any {
let testInjector = getTestInjector();
@ -148,6 +159,9 @@ export function inject(tokens: any[], fn: Function): () => any {
}
}
/**
* @experimental
*/
export class InjectSetupWrapper {
constructor(private _providers: () => any) {}
@ -166,6 +180,9 @@ export class InjectSetupWrapper {
}
}
/**
* @experimental
*/
export function withProviders(providers: () => any) {
return new InjectSetupWrapper(providers);
}

View File

@ -117,6 +117,8 @@ if (_global.beforeEach) {
/**
* Allows overriding default providers of the test injector,
* which are defined in test_injector.js
*
* @stable
*/
export function addProviders(providers: Array<any>): void {
if (!providers) return;