Skip to content

Commit 2466fc9

Browse files
alan-agius4pkozlowski-opensource
authored andcommitted
refactor(platform-browser-dynamic): relocate DOMTestComponentRenderer to @angular/platform-browser (#60453)
This commit moves `DOMTestComponentRenderer` to `@angular/platform-browser/testing`, allowing the Angular CLI to eliminate its dependency on `@angular/platform-browser-dynamic`, which would no longer be required for new projects. PR Close #60453
1 parent aa8ea7a commit 2466fc9

File tree

9 files changed

+21
-11
lines changed

9 files changed

+21
-11
lines changed

goldens/public-api/platform-browser-dynamic/index.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
55
```ts
66

7+
import * as _angular_core from '@angular/core';
78
import { Compiler } from '@angular/core';
89
import { CompilerFactory } from '@angular/core';
910
import { CompilerOptions } from '@angular/core';
10-
import * as i0 from '@angular/core';
1111
import { Version } from '@angular/core';
1212

1313
// @public @deprecated (undocumented)
@@ -17,7 +17,7 @@ export class JitCompilerFactory implements CompilerFactory {
1717
}
1818

1919
// @public (undocumented)
20-
export const platformBrowserDynamic: (extraProviders?: i0.StaticProvider[]) => i0.PlatformRef;
20+
export const platformBrowserDynamic: (extraProviders?: _angular_core.StaticProvider[]) => _angular_core.PlatformRef;
2121

2222
// @public (undocumented)
2323
export const VERSION: Version;

goldens/public-api/platform-browser-dynamic/testing/index.api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
55
```ts
66

7-
import * as i0 from '@angular/core';
7+
import * as _angular_core from '@angular/core';
88
import * as i1 from '@angular/platform-browser/testing';
99
import { PlatformRef } from '@angular/core';
1010
import { StaticProvider } from '@angular/core';
1111

1212
// @public
1313
export class BrowserDynamicTestingModule {
1414
// (undocumented)
15-
static ɵfac: i0.ɵɵFactoryDeclaration<BrowserDynamicTestingModule, never>;
15+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrowserDynamicTestingModule, never>;
1616
// (undocumented)
17-
static ɵinj: i0.ɵɵInjectorDeclaration<BrowserDynamicTestingModule>;
17+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<BrowserDynamicTestingModule>;
1818
// (undocumented)
19-
static ɵmod: i0.ɵɵNgModuleDeclaration<BrowserDynamicTestingModule, never, never, [typeof i1.BrowserTestingModule]>;
19+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<BrowserDynamicTestingModule, never, never, [typeof i1.BrowserTestingModule]>;
2020
}
2121

2222
// @public (undocumented)

packages/core/testing/src/test_bed_compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ export class TestBedCompiler {
989989
}
990990

991991
const providers: StaticProvider[] = [];
992-
const compilerOptions = this.platform.injector.get(COMPILER_OPTIONS);
992+
const compilerOptions = this.platform.injector.get(COMPILER_OPTIONS, []);
993993
compilerOptions.forEach((opts) => {
994994
if (opts.providers) {
995995
providers.push(opts.providers);

packages/platform-browser-dynamic/testing/src/private_export_testing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
export {DOMTestComponentRenderer as ɵDOMTestComponentRenderer} from './dom_test_component_renderer';
109
export {platformCoreDynamicTesting as ɵplatformCoreDynamicTesting} from './platform_core_dynamic_testing';
10+
export {ɵDOMTestComponentRenderer} from '@angular/platform-browser/testing';

packages/platform-browser-dynamic/testing/src/testing.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
*/
88

99
import {createPlatformFactory, NgModule, PlatformRef, StaticProvider} from '@angular/core';
10-
import {TestComponentRenderer} from '@angular/core/testing';
1110
import {ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from '@angular/platform-browser-dynamic';
1211
import {BrowserTestingModule} from '@angular/platform-browser/testing';
1312

14-
import {DOMTestComponentRenderer} from './dom_test_component_renderer';
1513
import {platformCoreDynamicTesting} from './platform_core_dynamic_testing';
1614

1715
export * from './private_export_testing';
@@ -32,6 +30,5 @@ export const platformBrowserDynamicTesting = createPlatformFactory(
3230
*/
3331
@NgModule({
3432
exports: [BrowserTestingModule],
35-
providers: [{provide: TestComponentRenderer, useClass: DOMTestComponentRenderer}],
3633
})
3734
export class BrowserDynamicTestingModule {}

packages/platform-browser/testing/src/browser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import {
1818
ɵChangeDetectionScheduler as ChangeDetectionScheduler,
1919
ɵChangeDetectionSchedulerImpl as ChangeDetectionSchedulerImpl,
2020
} from '@angular/core';
21+
import {TestComponentRenderer} from '@angular/core/testing';
2122
import {BrowserModule, ɵBrowserDomAdapter as BrowserDomAdapter} from '@angular/platform-browser';
23+
import {DOMTestComponentRenderer} from './dom_test_component_renderer';
2224

2325
function initBrowserTests() {
2426
BrowserDomAdapter.makeCurrent();
@@ -51,6 +53,7 @@ export const platformBrowserTesting = createPlatformFactory(
5153
internalProvideZoneChangeDetection({}),
5254
{provide: ChangeDetectionScheduler, useExisting: ChangeDetectionSchedulerImpl},
5355
{provide: PlatformLocation, useClass: MockPlatformLocation},
56+
{provide: TestComponentRenderer, useClass: DOMTestComponentRenderer},
5457
],
5558
})
5659
export class BrowserTestingModule {}

packages/platform-browser-dynamic/testing/src/dom_test_component_renderer.ts renamed to packages/platform-browser/testing/src/dom_test_component_renderer.ts

File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.dev/license
7+
*/
8+
9+
export {DOMTestComponentRenderer as ɵDOMTestComponentRenderer} from './dom_test_component_renderer';

packages/platform-browser/testing/src/testing.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
* Entry point for all public APIs of the platform-browser/testing package.
1313
*/
1414
export * from './browser';
15+
export * from './private_export_testing';

0 commit comments

Comments
 (0)