diff --git a/src/cdk/menu/menu-base.ts b/src/cdk/menu/menu-base.ts index a7305ec26b6f..4af909003931 100644 --- a/src/cdk/menu/menu-base.ts +++ b/src/cdk/menu/menu-base.ts @@ -47,6 +47,7 @@ let nextId = 0; '(focusin)': 'menuStack.setHasFocus(true)', '(focusout)': 'menuStack.setHasFocus(false)', }, + standalone: true, }) export abstract class CdkMenuBase extends CdkMenuGroup diff --git a/src/cdk/menu/menu-item-selectable.ts b/src/cdk/menu/menu-item-selectable.ts index 1543bc0feabf..4f763db6af63 100644 --- a/src/cdk/menu/menu-item-selectable.ts +++ b/src/cdk/menu/menu-item-selectable.ts @@ -15,6 +15,7 @@ import {CdkMenuItem} from './menu-item'; '[attr.aria-checked]': '!!checked', '[attr.aria-disabled]': 'disabled || null', }, + standalone: true, }) export abstract class CdkMenuItemSelectable extends CdkMenuItem { /** Whether the element is checked */ diff --git a/src/cdk/menu/menu-trigger-base.ts b/src/cdk/menu/menu-trigger-base.ts index bf0ab7509a61..0bafe5d7ba5d 100644 --- a/src/cdk/menu/menu-trigger-base.ts +++ b/src/cdk/menu/menu-trigger-base.ts @@ -34,6 +34,7 @@ export const MENU_TRIGGER = new InjectionToken('cdk-menu-tri '[attr.aria-controls]': 'childMenu?.id', '[attr.data-cdk-menu-stack-id]': 'menuStack.id', }, + standalone: true, }) export abstract class CdkMenuTriggerBase implements OnDestroy { /** The DI injector for this component. */ diff --git a/src/cdk/testing/tests/index.ts b/src/cdk/testing/tests/index.ts index 33082dc922ca..8cea8b0a5411 100644 --- a/src/cdk/testing/tests/index.ts +++ b/src/cdk/testing/tests/index.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -export * from './test-components-module'; export * from './test-main-component'; export * from './test-sub-component'; export * from './test-shadow-boundary'; diff --git a/src/cdk/testing/tests/test-components-module.ts b/src/cdk/testing/tests/test-components-module.ts deleted file mode 100644 index 304e8367dead..000000000000 --- a/src/cdk/testing/tests/test-components-module.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license - * Copyright Google LLC 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 - */ - -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {FormsModule, ReactiveFormsModule} from '@angular/forms'; -import {BrowserModule} from '@angular/platform-browser'; -import {TestMainComponent} from './test-main-component'; -import {TestShadowBoundary, TestSubShadowBoundary} from './test-shadow-boundary'; -import {TestSubComponent} from './test-sub-component'; - -@NgModule({ - imports: [BrowserModule, CommonModule, FormsModule, ReactiveFormsModule], - declarations: [TestMainComponent, TestSubComponent, TestShadowBoundary, TestSubShadowBoundary], - exports: [TestMainComponent, TestSubComponent, TestShadowBoundary, TestSubShadowBoundary], - bootstrap: [TestMainComponent], -}) -export class TestComponentsModule {} diff --git a/src/cdk/testing/tests/test-main-component.ts b/src/cdk/testing/tests/test-main-component.ts index cb28eb951f16..0905f15fc606 100644 --- a/src/cdk/testing/tests/test-main-component.ts +++ b/src/cdk/testing/tests/test-main-component.ts @@ -8,7 +8,7 @@ import {ENTER} from '@angular/cdk/keycodes'; import {_supportsShadowDom} from '@angular/cdk/platform'; -import {FormControl} from '@angular/forms'; +import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -19,12 +19,16 @@ import { ViewChild, ViewEncapsulation, } from '@angular/core'; +import {TestShadowBoundary} from './test-shadow-boundary'; +import {TestSubComponent} from './test-sub-component'; @Component({ selector: 'test-main', templateUrl: 'test-main-component.html', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [TestShadowBoundary, TestSubComponent, FormsModule, ReactiveFormsModule], }) export class TestMainComponent implements OnDestroy { username: string; @@ -54,7 +58,10 @@ export class TestMainComponent implements OnDestroy { private _fakeOverlayElement: HTMLElement; - constructor(private _cdr: ChangeDetectorRef, private _zone: NgZone) { + constructor( + private _cdr: ChangeDetectorRef, + private _zone: NgZone, + ) { this.username = 'Yi'; this.counter = 0; this.asyncCounter = 0; diff --git a/src/cdk/testing/tests/test-shadow-boundary.ts b/src/cdk/testing/tests/test-shadow-boundary.ts index ee7cb1d0616d..76a0c93997d9 100644 --- a/src/cdk/testing/tests/test-shadow-boundary.ts +++ b/src/cdk/testing/tests/test-shadow-boundary.ts @@ -9,22 +9,25 @@ import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; @Component({ - selector: 'test-shadow-boundary', - template: ` -
Shadow 1
- - `, + selector: 'test-sub-shadow-boundary', + template: '
Shadow 2
', changeDetection: ChangeDetectionStrategy.OnPush, // tslint:disable-next-line:validate-decorators encapsulation: ViewEncapsulation.ShadowDom, + standalone: true, }) -export class TestShadowBoundary {} +export class TestSubShadowBoundary {} @Component({ - selector: 'test-sub-shadow-boundary', - template: '
Shadow 2
', + selector: 'test-shadow-boundary', + template: ` +
Shadow 1
+ + `, changeDetection: ChangeDetectionStrategy.OnPush, // tslint:disable-next-line:validate-decorators encapsulation: ViewEncapsulation.ShadowDom, + standalone: true, + imports: [TestSubShadowBoundary], }) -export class TestSubShadowBoundary {} +export class TestShadowBoundary {} diff --git a/src/cdk/testing/tests/test-sub-component.ts b/src/cdk/testing/tests/test-sub-component.ts index 0eb519f75bdc..ff05521480f4 100644 --- a/src/cdk/testing/tests/test-sub-component.ts +++ b/src/cdk/testing/tests/test-sub-component.ts @@ -19,6 +19,7 @@ import {ChangeDetectionStrategy, Component, Input, ViewEncapsulation} from '@ang `, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, }) export class TestSubComponent { @Input() title: string; diff --git a/src/cdk/testing/tests/testbed.spec.ts b/src/cdk/testing/tests/testbed.spec.ts index 9ac50f8a8f2f..d63f205f1a38 100644 --- a/src/cdk/testing/tests/testbed.spec.ts +++ b/src/cdk/testing/tests/testbed.spec.ts @@ -6,14 +6,12 @@ import {querySelectorAll as piercingQuerySelectorAll} from 'kagekiri'; import {crossEnvironmentSpecs} from './cross-environment.spec'; import {FakeOverlayHarness} from './harnesses/fake-overlay-harness'; import {MainComponentHarness} from './harnesses/main-component-harness'; -import {TestComponentsModule} from './test-components-module'; import {TestMainComponent} from './test-main-component'; describe('TestbedHarnessEnvironment', () => { let fixture: ComponentFixture<{}>; - beforeEach(async () => { - await TestBed.configureTestingModule({imports: [TestComponentsModule]}).compileComponents(); + beforeEach(() => { fixture = TestBed.createComponent(TestMainComponent); }); @@ -38,9 +36,10 @@ describe('TestbedHarnessEnvironment', () => { }); it('should be able to load harness through document root loader', async () => { - const documentRootHarnesses = await TestbedHarnessEnvironment.documentRootLoader( - fixture, - ).getAllHarnesses(FakeOverlayHarness); + const documentRootHarnesses = + await TestbedHarnessEnvironment.documentRootLoader(fixture).getAllHarnesses( + FakeOverlayHarness, + ); const fixtureHarnesses = await loader.getAllHarnesses(FakeOverlayHarness); expect(fixtureHarnesses.length).toBe(0); expect(documentRootHarnesses.length).toBe(1); diff --git a/src/e2e-app/components/component-harness-e2e.ts b/src/e2e-app/components/component-harness-e2e.ts index 1320be8ccd78..c951a28230c5 100644 --- a/src/e2e-app/components/component-harness-e2e.ts +++ b/src/e2e-app/components/component-harness-e2e.ts @@ -1,5 +1,5 @@ import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; -import {TestComponentsModule} from '@angular/cdk/testing/tests'; +import {TestMainComponent} from '@angular/cdk/testing/tests'; @Component({ selector: 'component-harness-e2e', @@ -7,6 +7,6 @@ import {TestComponentsModule} from '@angular/cdk/testing/tests'; encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [TestComponentsModule], + imports: [TestMainComponent], }) export class ComponentHarnessE2e {} diff --git a/src/material/list/list-base.ts b/src/material/list/list-base.ts index 2b05b5867f28..5feaccab89dd 100644 --- a/src/material/list/list-base.ts +++ b/src/material/list/list-base.ts @@ -42,6 +42,7 @@ import {MAT_LIST_CONFIG} from './tokens'; host: { '[attr.aria-disabled]': 'disabled', }, + standalone: true, }) /** @docs-private */ export abstract class MatListBase { @@ -79,6 +80,7 @@ export abstract class MatListBase { '[attr.aria-disabled]': 'disabled', '[attr.disabled]': '(_isButtonElement && disabled) || null', }, + standalone: true, }) /** @docs-private */ export abstract class MatListItemBase implements AfterViewInit, OnDestroy, RippleTarget { diff --git a/src/material/list/list-item-sections.ts b/src/material/list/list-item-sections.ts index 37f19c812d8b..0ca18e781fec 100644 --- a/src/material/list/list-item-sections.ts +++ b/src/material/list/list-item-sections.ts @@ -69,6 +69,7 @@ export class MatListItemMeta {} '[class.mdc-list-item__start]': '_isAlignedAtStart()', '[class.mdc-list-item__end]': '!_isAlignedAtStart()', }, + standalone: true, }) export class _MatListItemGraphicBase { constructor(@Optional() @Inject(LIST_OPTION) public _listOption: ListOption) {} diff --git a/tools/public_api_guard/cdk/menu.md b/tools/public_api_guard/cdk/menu.md index a3e127dcc32a..8a57756a4e9c 100644 --- a/tools/public_api_guard/cdk/menu.md +++ b/tools/public_api_guard/cdk/menu.md @@ -101,7 +101,7 @@ export abstract class CdkMenuBase extends CdkMenuGroup implements Menu, AfterCon protected pointerTracker?: PointerFocusTracker; protected triggerItem?: CdkMenuItem; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -183,7 +183,7 @@ export abstract class CdkMenuItemSelectable extends CdkMenuItem { // (undocumented) static ngAcceptInputType_checked: unknown; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -235,7 +235,7 @@ export abstract class CdkMenuTriggerBase implements OnDestroy { protected readonly stopOutsideClicksListener: Observable; protected readonly viewContainerRef: ViewContainerRef; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } diff --git a/tools/public_api_guard/material/list.md b/tools/public_api_guard/material/list.md index 31ec2de579be..3a35d95306cc 100644 --- a/tools/public_api_guard/material/list.md +++ b/tools/public_api_guard/material/list.md @@ -104,7 +104,7 @@ export class _MatListItemGraphicBase { // (undocumented) _listOption: ListOption; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration<_MatListItemGraphicBase, never, never, {}, {}, never, never, false, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration<_MatListItemGraphicBase, never, never, {}, {}, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<_MatListItemGraphicBase, [{ optional: true; }]>; } diff --git a/tslint.json b/tslint.json index f334365f7c03..11e0d2d1b1d9 100644 --- a/tslint.json +++ b/tslint.json @@ -97,13 +97,15 @@ "!styles": ".*", "!moduleId": ".*", "changeDetection": "\\.OnPush$", - "encapsulation": "\\.None$" + "encapsulation": "\\.None$", + "standalone": "^true$" } }, "Directive": { "argument": 0, "properties": { - "!host": "\\[class\\]" + "!host": "\\[class\\]", + "standalone": "^true$" } }, "NgModule": {