8000 feat(template): migrate LetDirective to standalone API · rx-angular/rx-angular@a342dfe · GitHub
[go: up one dir, main page]

Skip to content

Commit a342dfe

Browse files
committed
feat(template): migrate LetDirective to standalone API
1 parent 8e2441a commit a342dfe

13 files changed

+31
-15
lines changed

libs/template/let/src/lib/let.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface RxLetViewContext<T> extends RxViewContext<T> {
9292
* @docsPage LetDirective
9393
* @publicApi
9494
*/
95-
@Directive({ selector: '[rxLet]' })
95+
@Directive({ selector: '[rxLet]', standalone: true })
9696
export class LetDirective<U> implements OnInit, OnDestroy, OnChanges {
9797
static ngTemplateGuard_rxLet: 'binding';
9898

libs/template/let/src/lib/let.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { NgModule } from '@angular/core';
22

33
import { LetDirective } from './let.directive';
44

5+
/** @deprecated use the standalone import, will be removed with v16 */
56
@NgModule({
6-
declarations: [LetDirective],
7+
imports: [LetDirective],
78
exports: [LetDirective],
89
})
910
export class LetModule {}

libs/template/let/src/lib/tests/let.directive.complete.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ let componentNativeElement: any;
3232

3333
const setupLetDirectiveTestComponentComplete = (): void => {
3434
TestBed.configureTestingModule({
35-
declarations: [LetDirectiveTestCompleteComponent, LetDirective],
35+
declarations: [LetDirectiveTestCompleteComponent],
36+
imports: [LetDirective],
3637
providers: [
3738
{ provide: ChangeDetectorRef, useClass: MockChangeDetectorRef },
3839
TemplateRef,

libs/template/let/src/lib/tests/let.directive.context.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ const contentElement = (): HTMLElement => nativeElement.querySelector('.value');
6565

6666
const setupTestComponent = () => {
6767
TestBed.configureTestingModule({
68-
declarations: [LetDirectiveTestComponent, LetDirective],
68+
declarations: [LetDirectiveTestComponent],
69+
imports: [LetDirective],
6970
providers: [
7071
{ provide: ChangeDetectorRef, useClass: MockChangeDetectorRef },
7172
TemplateRef,

libs/template/let/src/lib/tests/let.directive.error.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class LetDirectiveTestErrorComponent {
2525

2626
const setupLetDirectiveTestComponentError = (): void => {
2727
TestBed.configureTestingModule({
28-
declarations: [LetDirectiveTestErrorComponent, LetDirective],
28+
declarations: [LetDirectiveTestErrorComponent],
29+
imports: [LetDirective],
2930
providers: [
3031
{ provide: ChangeDetectorRef, useClass: MockChangeDetectorRef },
3132
TemplateRef,

libs/template/let/src/lib/tests/let.directive.next.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ let componentNativeElement: any;
3636

3737
const setupLetDirectiveTestComponent = (): void => {
3838
TestBed.configureTestingModule({
39-
declarations: [LetDirectiveTestComponent, LetDirective],
39+
declarations: [LetDirectiveTestComponent],
40+
imports: [LetDirective],
4041
providers: [
4142
{ provide: ChangeDetectorRef, useClass: MockChangeDetectorRef },
4243
TemplateRef,

libs/template/let/src/lib/tests/let.directive.parent-notification.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ describe('LetDirective parent notification', () => {
5959
// beforeAll(() => mockConsole());
6060
beforeEach(() => {
6161
TestBed.configureTestingModule({
62-
declarations: [LetDirectiveTestStrategyComponent, LetDirective],
62+
declarations: [LetDirectiveTestStrategyComponent],
63+
imports: [LetDirective],
6364
teardown: { destroyAfterEach: true },
6465
});
6566
});

libs/template/let/src/lib/tests/let.directive.rendered.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ let componentNativeElement: any;
3434

3535
const setupLetDirectiveTestComponent = (): void => {
3636
TestBed.configureTestingModule({
37-
declarations: [LetDirectiveTestComponent, LetDirective],
37+
declarations: [LetDirectiveTestComponent],
38+
imports: [LetDirective],
3839
providers: [
3940
{ provide: ChangeDetectorRef, useClass: MockChangeDetectorRef },
4041
TemplateRef,

libs/template/let/src/lib/tests/let.directive.strategy.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ let strategyProvider: RxStrategyProvider;
3737
describe('LetDirective strategies', () => {
3838
beforeEach(() => {
3939
TestBed.configureTestingModule({
40-
declarations: [LetDirectiveTestStrategyComponent, LetDirective],
40+
declarations: [LetDirectiveTestStrategyComponent],
41+
imports: [LetDirective],
4142
teardown: { destroyAfterEach: true },
4243
});
4344
});

libs/template/let/src/lib/tests/let.directive.template-binding.all.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ let nativeElement: HTMLElement;
7171

7272
const setupTestComponent = () => {
7373
TestBed.configureTestingModule({
74-
declarations: [LetDirectiveAllTemplatesTestComponent, LetDirective],
74+
declarations: [LetDirectiveAllTemplatesTestComponent],
75+
imports: [LetDirective],
7576
providers: [
7677
{ provide: ChangeDetectorRef, useClass: MockChangeDetectorRef },
7778
TemplateRef,

libs/template/let/src/lib/tests/let.directive.template-binding.no-complete.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { ChangeDetectorRef, Component, TemplateRef, ViewContainerRef } from '@angular/core';
1+
import {
2+
ChangeDetectorRef,
3+
Component,
4+
TemplateRef,
5+
ViewContainerRef,
6+
} from '@angular/core';
27
import { ComponentFixture, TestBed } from '@angular/core/testing';
38
import { RX_RENDER_STRATEGIES_CONFIG } from '@rx-angular/cdk/render-strategies';
49
import { mockConsole } from '@test-helpers';
@@ -28,7 +33,8 @@ let nativeElement: HTMLElement;
2833

2934
const setupTestComponent = () => {
3035
TestBed.configureTestingModule({
31-
declarations: [LetDirectiveNoCompleteTemplateTestComponent, LetDirective],
36+
declarations: [LetDirectiveNoCompleteTemplateTestComponent],
37+
imports: [LetDirective],
3238
providers: [
3339
{ provide: ChangeDetectorRef, useClass: MockChangeDetectorRef },
3440
TemplateRef,

libs/template/let/src/lib/tests/let.directive.template-binding.no-error.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ const setupTestComponent = () => {
4040
},
4141
},
4242
],
43-
declarations: [LetDirectiveNoErrorTemplateTestComponent, LetDirective],
43+
declarations: [LetDirectiveNoErrorTemplateTestComponent],
44+
imports: [LetDirective],
4445
teardown: { destroyAfterEach: true },
4546
});
4647
};

libs/template/let/src/lib/tests/let.directive.template-binding.no-suspense.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { mockConsole } from '@test-helpers';
55
import { Observable, of, Subject } from 'rxjs';
66
import { LetDirective } from '../let.directive';
77

8-
98
@Component({
109
template: `
1110
<ng-container
@@ -33,7 +32,8 @@ let nativeElement: HTMLElement;
3332

3433
const setupTestComponent = () => {
3534
TestBed.configureTestingModule({
36-
declarations: [LetDirectiveNoSuspenseTemplateTestComponent, LetDirective],
35+
declarations: [LetDirectiveNoSuspenseTemplateTestComponent],
36+
imports: [LetDirective],
3737
providers: [
3838
{
3939
provide: RX_RENDER_STRATEGIES_CONFIG,

0 commit comments

Comments
 (0)
0