Skip to content

Commit 44ba902

Browse files
crisbetommalerba
authored andcommitted
test: clean up remaining dynamic query usages (#20156)
For a while we had linting to explicitly specify the `static` flag on queries and we eventually removed it in ece8004, but there are still some PRs going in that were written while the restriction was in place. These changes clean up the remaining instances.
1 parent b1bfcf0 commit 44ba902

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

src/cdk/a11y/focus-trap/focus-trap.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ class FocusTrapWithoutFocusableElements {
345345
`,
346346
})
347347
class FocusTrapInsidePortal {
348-
@ViewChild('template', {static: false}) template: TemplateRef<any>;
349-
@ViewChild(CdkPortalOutlet, {static: false}) portalOutlet: CdkPortalOutlet;
348+
@ViewChild('template') template: TemplateRef<any>;
349+
@ViewChild(CdkPortalOutlet) portalOutlet: CdkPortalOutlet;
350350

351351
constructor(public viewContainerRef: ViewContainerRef) {}
352352
}

src/cdk/drag-drop/directives/drag.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5449,9 +5449,9 @@ class StandaloneDraggableWithHandle {
54495449
`
54505450
})
54515451
class StandaloneDraggableWithPreDisabledHandle {
5452-
@ViewChild('dragElement', {static: false}) dragElement: ElementRef<HTMLElement>;
5453-
@ViewChild('handleElement', {static: false}) handleElement: ElementRef<HTMLElement>;
5454-
@ViewChild(CdkDrag, {static: false}) dragInstance: CdkDrag;
5452+
@ViewChild('dragElement') dragElement: ElementRef<HTMLElement>;
5453+
@ViewChild('handleElement') handleElement: ElementRef<HTMLElement>;
5454+
@ViewChild(CdkDrag) dragInstance: CdkDrag;
54555455
disableHandle = true;
54565456
}
54575457

src/cdk/portal/portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Usage:
8888
```
8989

9090
```ts
91-
@ViewChild('domPortalContent', {static: false}) domPortalContent: ElementRef<HTMLElement>;
91+
@ViewChild('domPortalContent') domPortalContent: ElementRef<HTMLElement>;
9292
ngAfterViewInit() {
9393
this.domPortal = new DomPortal(this.domPortalContent);
9494
}

src/cdk/portal/portal.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,8 @@ class SaveParentNodeOnInit implements AfterViewInit {
678678
`
679679
})
680680
class ArbitraryViewContainerRefComponent {
681-
@ViewChild('template', {static: false}) template: TemplateRef<any>;
682-
@ViewChild(SaveParentNodeOnInit, {static: false}) saveParentNodeOnInit: SaveParentNodeOnInit;
681+
@ViewChild('template') template: TemplateRef<any>;
682+
@ViewChild(SaveParentNodeOnInit) saveParentNodeOnInit: SaveParentNodeOnInit;
683683

684684
constructor(public viewContainerRef: ViewContainerRef, public injector: Injector) { }
685685
}

src/dev-app/portal/portal-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {Component, QueryList, ViewChildren, ElementRef, ViewChild} from '@angula
1717
})
1818
export class PortalDemo {
1919
@ViewChildren(CdkPortal) templatePortals: QueryList<Portal<any>>;
20-
@ViewChild('domPortalSource', {static: false}) domPortalSource: ElementRef<HTMLElement>;
20+
@ViewChild('domPortalSource') domPortalSource: ElementRef<HTMLElement>;
2121

2222
selectedPortal: Portal<any>;
2323

src/google-maps/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import {MapInfoWindow, MapMarker} from '@angular/google-maps';
6666
templateUrl: 'google-map-demo.html',
6767
})
6868
export class GoogleMapDemo {
69-
@ViewChild(MapInfoWindow, {static: false}) infoWindow: MapInfoWindow;
69+
@ViewChild(MapInfoWindow) infoWindow: MapInfoWindow;
7070

7171
center = {lat: 24, lng: 12};
7272
markerOptions = {draggable: false};

src/material-experimental/column-resize/column-resize.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const MOUSE_START_OFFSET = 1000;
157157

158158
@Directive()
159159
abstract class BaseTestComponent {
160-
@ViewChild('table', {static: false}) table: ElementRef;
160+
@ViewChild('table') table: ElementRef;
161161

162162
abstract columnResize: AbstractMatColumnResize;
163163

src/material-experimental/mdc-menu/menu.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,8 +2582,8 @@ class SimpleMenuWithRepeater {
25822582
`
25832583
})
25842584
class SimpleMenuWithRepeaterInLazyContent {
2585-
@ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger;
2586-
@ViewChild(MatMenu, {static: false}) menu: MatMenu;
2585+
@ViewChild(MatMenuTrigger) trigger: MatMenuTrigger;
2586+
@ViewChild(MatMenu) menu: MatMenu;
25872587
items = [{label: 'Pizza', disabled: false}, {label: 'Pasta', disabled: false}];
25882588
}
25892589

src/material/expansion/accordion.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ class SetOfItems {
337337
</mat-accordion>`})
338338
class NestedAccordions {
339339
@ViewChildren(MatExpansionPanelHeader) headers: QueryList<MatExpansionPanelHeader>;
340-
@ViewChild('secondOuterHeader', {static: false}) secondOuterHeader: MatExpansionPanelHeader;
341-
@ViewChild('firstInnerHeader', {static: false}) firstInnerHeader: MatExpansionPanelHeader;
340+
@ViewChild('secondOuterHeader') secondOuterHeader: MatExpansionPanelHeader;
341+
@ViewChild('firstInnerHeader') firstInnerHeader: MatExpansionPanelHeader;
342342
}
343343

344344
@Component({template: `

src/material/menu/menu.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,8 +2602,8 @@ class SimpleMenuWithRepeater {
26022602
`
26032603
})
26042604
class SimpleMenuWithRepeaterInLazyContent {
2605-
@ViewChild(MatMenuTrigger, {static: false}) trigger: MatMenuTrigger;
2606-
@ViewChild(MatMenu, {static: false}) menu: MatMenu;
2605+
@ViewChild(MatMenuTrigger) trigger: MatMenuTrigger;
2606+
@ViewChild(MatMenu) menu: MatMenu;
26072607
items = [{label: 'Pizza', disabled: false}, {label: 'Pasta', disabled: false}];
26082608
}
26092609

0 commit comments

Comments
 (0)