Skip to content

Commit 8bc18f9

Browse files
authored
fix(action-strip): update ContentChildren decorator for actionButtons property - master (#16844)
1 parent 5b681a1 commit 8bc18f9

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

projects/igniteui-angular-elements/src/analyzer/elements.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ export var registerConfig = [
4848
IgxHierarchicalGridComponent,
4949
IgxRowIslandComponent,
5050
],
51-
contentQueries: [],
51+
contentQueries: [
52+
{
53+
property: "actionButtons",
54+
childType: IgxActionStripActionsToken,
55+
isQueryList: true,
56+
},
57+
],
5258
additionalProperties: [{ name: "cdr", writable: true }],
5359
methods: ["show", "hide"],
5460
boolProps: ["hidden"],

projects/igniteui-angular-elements/src/app/custom-strategy.spec.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IgxColumnComponent, IgxGridComponent, IgxHierarchicalGridComponent } from 'igniteui-angular';
1+
import { IgxActionStripComponent, IgxColumnComponent, IgxGridComponent, IgxHierarchicalGridComponent } from 'igniteui-angular';
22
import { html } from 'lit';
33
import { firstValueFrom, fromEvent, skip, timer } from 'rxjs';
44
import { ComponentRefKey, IgcNgElement } from './custom-strategy';
@@ -235,6 +235,23 @@ describe('Elements: ', () => {
235235
expect(grid.getColumnByVisibleIndex(1).field).toEqual('ProductName');
236236
});
237237

238+
it('should populate action strip actionButtons content query.', async () => {
239+
const innerHtml = `
240+
<igc-grid id="testGrid" auto-generate>
241+
<igc-action-strip id="testStrip">
242+
<igc-grid-editing-actions add-row="true"></igc-grid-editing-actions>
243+
</igc-action-strip>
244+
</igc-grid>`;
245+
testContainer.innerHTML = innerHtml;
246+
247+
// TODO: Better way to wait - potentially expose the queue or observable for update on the strategy
248+
await firstValueFrom(timer(10 /* SCHEDULE_DELAY */ * 3));
249+
250+
const actionStrip = document.querySelector<IgcNgElement>('#testStrip');
251+
const actionStripComponent = (await actionStrip.ngElementStrategy[ComponentRefKey]).instance as IgxActionStripComponent;
252+
expect(actionStripComponent.actionButtons.toArray().length).toBeGreaterThan(0);
253+
});
254+
238255
it('should not destroy action strip when row it is shown in is destroyed or cached.', async() => {
239256
const innerHtml = `
240257
<igc-grid id="testGrid" auto-generate>

projects/igniteui-angular/action-strip/src/action-strip/action-strip.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class IgxActionStripComponent implements IgxActionStripToken, AfterViewIn
134134
* @hidden
135135
* @internal
136136
*/
137-
@ContentChildren(IgxActionStripActionsToken as any)
137+
@ContentChildren(IgxActionStripActionsToken)
138138
public actionButtons: QueryList<IgxActionStripActionsToken>;
139139

140140
/**

0 commit comments

Comments
 (0)