File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
projects/igniteui-angular-elements/src/app Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -48,15 +48,31 @@ describe('Elements: ', () => {
4848 const columnEl = document . createElement ( "igc-column" ) as IgcNgElement ;
4949 gridEl . appendChild ( columnEl ) ;
5050
51- // TODO: Better way to wait - potentially expose the queue or observable for update on the strategy
52- await firstValueFrom ( timer ( 10 /* SCHEDULE_DELAY */ * 2 ) ) ;
53-
51+ // Wait for both components to be fully initialized
5452 const gridComponent = ( await gridEl . ngElementStrategy [ ComponentRefKey ] ) . instance as IgxGridComponent ;
5553 const columnComponent = ( await columnEl . ngElementStrategy [ ComponentRefKey ] ) . instance as IgxColumnComponent ;
54+
55+ // Wait for the grid's columnList to contain the column component with retry logic
56+ let retries = 0 ;
57+ const maxRetries = 10 ;
58+ const retryDelay = 10 ;
59+
60+ while ( retries < maxRetries && ! gridComponent . columnList . toArray ( ) . includes ( columnComponent ) ) {
61+ await firstValueFrom ( timer ( retryDelay ) ) ;
62+ retries ++ ;
63+ }
64+
5665 expect ( gridComponent . columnList . toArray ( ) ) . toContain ( columnComponent ) ;
5766
5867 columnEl . remove ( ) ;
59- await firstValueFrom ( timer ( 10 /* SCHEDULE_DELAY: DESTROY + QUERY */ * 3 ) ) ;
68+
69+ // Wait for the column to be removed from the columnList with retry logic
70+ retries = 0 ;
71+ while ( retries < maxRetries && gridComponent . columnList . toArray ( ) . includes ( columnComponent ) ) {
72+ await firstValueFrom ( timer ( retryDelay ) ) ;
73+ retries ++ ;
74+ }
75+
6076 expect ( gridComponent . columnList . toArray ( ) ) . toEqual ( [ ] ) ;
6177 } ) ;
6278
You can’t perform that action at this time.
0 commit comments