Skip to content

Commit 51c09eb

Browse files
committed
test(elements): fix flickering columns manipulation test
1 parent 655ad20 commit 51c09eb

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,10 @@ describe('Elements: ', () => {
204204
</igc-column-layout>
205205
</igc-grid>`;
206206
testContainer.innerHTML = innerHtml;
207+
const grid = document.querySelector<IgcNgElement & InstanceType<typeof IgcGridComponent>>('#testGrid');
207208

208-
// TODO: Better way to wait - potentially expose the queue or observable for update on the strategy
209-
await firstValueFrom(timer(10 /* SCHEDULE_DELAY */ * 3));
209+
await firstValueFrom(fromEvent(grid, "childrenResolved"));
210210

211-
const grid = document.querySelector<IgcNgElement & InstanceType<typeof IgcGridComponent>>('#testGrid');
212211
const thirdGroup = document.querySelector<IgcNgElement>('igc-column-layout[header="Product Stock"]');
213212
const secondGroup = document.querySelector<IgcNgElement>('igc-column-layout[header="Product Details"]');
214213

@@ -217,7 +216,7 @@ describe('Elements: ', () => {
217216
expect(grid.getColumnByVisibleIndex(1).field).toEqual('ProductName');
218217

219218
grid.removeChild(secondGroup);
220-
await firstValueFrom(timer(10 /* SCHEDULE_DELAY */ * 3));
219+
await firstValueFrom(fromEvent(grid, "childrenResolved"));
221220

222221
expect(grid.columns.length).toEqual(4);
223222
expect(grid.getColumnByName('ProductID')).toBeTruthy();
@@ -229,7 +228,7 @@ describe('Elements: ', () => {
229228
newColumn.setAttribute('field', 'ProductName');
230229
newGroup.appendChild(newColumn);
231230
grid.insertBefore(newGroup, thirdGroup);
232-
await firstValueFrom(timer(10 /* SCHEDULE_DELAY */ * 3));
231+
await firstValueFrom(fromEvent(grid, "childrenResolved"));
233232

234233
expect(grid.columns.length).toEqual(6);
235234
expect(grid.getColumnByVisibleIndex(1).field).toEqual('ProductName');

0 commit comments

Comments
 (0)