Skip to content

Commit

Permalink
refactor(core): remove withBody from public testing API (angular#25171)
Browse files Browse the repository at this point in the history
PR Close angular#25171
  • Loading branch information
mhevery authored and IgorMinar committed Jul 31, 2018
1 parent aafd502 commit 6e2a187
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/core/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ts_library(
"//packages/platform-browser-dynamic",
"//packages/platform-browser/animations",
"//packages/platform-browser/testing",
"//packages/private/testing",
"//packages/router",
"//packages/router/testing",
"@rxjs",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/test/application_ref_integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
*/

import {ApplicationModule, ApplicationRef, DoCheck, InjectFlags, InjectorType, Input, OnInit, PlatformRef, TestabilityRegistry, Type, defineInjector, inject, ɵE as elementStart, ɵNgModuleDef as NgModuleDef, ɵRenderFlags as RenderFlags, ɵT as text, ɵdefineComponent as defineComponent, ɵe as elementEnd, ɵi1 as interpolation1, ɵt as textBinding} from '@angular/core';
import {getTestBed, withBody} from '@angular/core/testing';
import {getTestBed} from '@angular/core/testing';
import {BrowserModule, EVENT_MANAGER_PLUGINS, platformBrowser} from '@angular/platform-browser';
import {withBody} from '@angular/private/testing';

import {BROWSER_MODULE_PROVIDERS} from '../../platform-browser/src/browser';
import {APPLICATION_MODULE_PROVIDERS} from '../src/application_module';
Expand Down
1 change: 1 addition & 0 deletions packages/core/test/bundling/hello_world/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ts_library(
deps = [
"//packages:types",
"//packages/core/testing",
"//packages/private/testing",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {withBody} from '@angular/core/testing';
import {withBody} from '@angular/private/testing';
import * as fs from 'fs';
import * as path from 'path';

Expand Down
1 change: 1 addition & 0 deletions packages/core/test/bundling/hello_world_r2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ts_library(
deps = [
"//packages:types",
"//packages/core/testing",
"//packages/private/testing",
],
)

Expand Down
1 change: 1 addition & 0 deletions packages/core/test/bundling/injection/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ts_library(
":injection",
"//packages:types",
"//packages/core/testing",
"//packages/private/testing",
],
)

Expand Down
1 change: 1 addition & 0 deletions packages/core/test/bundling/todo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ts_library(
"//packages:types",
"//packages/core",
"//packages/core/testing",
"//packages/private/testing",
],
)

Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/bundling/todo/todo_e2e_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {ɵwhenRendered as whenRendered} from '@angular/core';
import {withBody} from '@angular/core/testing';
import {withBody} from '@angular/private/testing';
import * as fs from 'fs';
import * as path from 'path';

Expand Down
1 change: 1 addition & 0 deletions packages/core/test/render3/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ts_library(
"//packages/platform-browser",
"//packages/platform-browser/animations",
"//packages/platform-browser/testing",
"//packages/private/testing",
],
)

Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/render3/change_detection_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {withBody} from '@angular/core/testing';
import {withBody} from '@angular/private/testing';

import {ChangeDetectionStrategy, ChangeDetectorRef, DoCheck} from '../../src/core';
import {getRenderedText, whenRendered} from '../../src/render3/component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {NgForOf, NgForOfContext} from '@angular/common';
import {Component, ContentChild, Directive, EventEmitter, Injectable, Input, NgModule, OnDestroy, Optional, Output, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, Type, ViewChild, ViewContainerRef, defineInjectable, defineInjector} from '@angular/core';
import {withBody} from '@angular/core/testing';
import {withBody} from '@angular/private/testing';

import * as r3 from '../../../src/render3/index';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/render3/testing_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {withBody} from '@angular/core/testing';
import {withBody} from '@angular/private/testing';

describe('testing', () => {
describe('withBody', () => {
Expand Down
1 change: 0 additions & 1 deletion packages/core/testing/src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ export * from './test_bed';
export * from './before_each';
export * from './metadata_override';
export * from './private_export_testing';
export * from './render3';
16 changes: 16 additions & 0 deletions packages/private/testing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package(default_visibility = ["//visibility:public"])

exports_files(["package.json"])

load("//tools:defaults.bzl", "ng_module")

ng_module(
name = "testing",
srcs = glob(
["**/*.ts"],
),
module_name = "@angular/private/testing",
deps = [
"//packages/core",
],
)
9 changes: 9 additions & 0 deletions packages/private/testing/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @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
*/

export * from './src/render3';
File renamed without changes.
1 change: 1 addition & 0 deletions test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ System.config({
'@angular/platform-server': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-webworker': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-webworker-dynamic': {main: 'index.js', defaultExtension: 'js'},
'@angular/private/testing': {main: 'index.js', defaultExtension: 'js'},
'@angular/elements': {main: 'index.js', defaultExtension: 'js'},
'rxjs/ajax': {main: 'index.js', defaultExtension: 'js'},
'rxjs/operators': {main: 'index.js', defaultExtension: 'js'},
Expand Down
9 changes: 0 additions & 9 deletions tools/public_api_guard/core/testing.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export declare function async(fn: Function): (done: any) => any;

/** @experimental */
export declare function cleanupDocument(): void;

export declare class ComponentFixture<T> {
changeDetectorRef: ChangeDetectorRef;
componentInstance: T;
Expand Down Expand Up @@ -30,9 +27,6 @@ export declare const ComponentFixtureNoNgZone: InjectionToken<boolean[]>;
/** @experimental */
export declare function discardPeriodicTasks(): void;

/** @experimental */
export declare function ensureDocument(): void;

/** @experimental */
export declare function fakeAsync(fn: Function): (...args: any[]) => any;

Expand Down Expand Up @@ -147,9 +141,6 @@ export declare type TestModuleMetadata = {
/** @experimental */
export declare function tick(millis?: number): void;

/** @experimental */
export declare function withBody<T extends Function>(html: string, blockFn: T): T;

/** @experimental */
export declare function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper;
export declare function withModule(moduleDef: TestModuleMetadata, fn: Function): () => any;

0 comments on commit 6e2a187

Please sign in to comment.