@@ -3,14 +3,15 @@ import { ApplicationRef, importProvidersFrom } from '@angular/core';
33import { createApplication } from '@angular/platform-browser' ;
44import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
55import { BrowserTestingModule } from '@angular/platform-browser/testing' ;
6- import { IgxColumnComponent , IgxGridComponent , IgxHierarchicalGridComponent , IgxPaginatorComponent } from 'igniteui-angular' ;
6+ import { IgxColumnComponent , IgxGridComponent , IgxHierarchicalGridComponent , IgxPaginatorComponent , IgxPivotGridComponent } from 'igniteui-angular' ;
77import { firstValueFrom , fromEvent , skip , timer } from 'rxjs' ;
88import { registerConfig } from '../analyzer/elements.config' ;
99import { createIgxCustomElement } from './create-custom-element' ;
1010import { ComponentRefKey , IgcNgElement } from './custom-strategy' ;
1111import hgridData from '../assets/data/projects-hgrid.js' ;
1212import { SampleTestData } from 'igniteui-angular/src/lib/test-utils/sample-test-data.spec' ;
1313import { ELEMENTS_TOKEN } from 'igniteui-angular/src/lib/core/utils' ;
14+ import { IgxGridStateComponent } from '../lib/state.component' ;
1415
1516describe ( 'Elements: ' , ( ) => {
1617 let testContainer : HTMLDivElement ;
@@ -28,8 +29,13 @@ describe('Elements: ', () => {
2829 customElements . define ( "igc-grid" , grid ) ;
2930 const hgrid = createIgxCustomElement < IgxHierarchicalGridComponent > ( IgxHierarchicalGridComponent , { injector : appRef . injector , registerConfig } ) ;
3031 customElements . define ( "igc-hierarchical-grid" , hgrid ) ;
32+ const pivotGrid = createIgxCustomElement < IgxPivotGridComponent > ( IgxPivotGridComponent , { injector : appRef . injector , registerConfig } ) ;
33+ customElements . define ( "igc-pivot-grid" , pivotGrid ) ;
3134 const paginator = createIgxCustomElement < IgxPaginatorComponent > ( IgxPaginatorComponent , { injector : appRef . injector , registerConfig } ) ;
3235 customElements . define ( "igc-paginator" , paginator ) ;
36+ const stateComponent = createIgxCustomElement < IgxGridStateComponent > ( IgxGridStateComponent , { injector : appRef . injector , registerConfig } ) ;
37+ customElements . define ( "igc-grid-state" , stateComponent ) ;
38+
3339 } ) ;
3440
3541 beforeEach ( async ( ) => {
@@ -111,5 +117,19 @@ describe('Elements: ', () => {
111117 expect ( gridEl . dataView . length ) . toEqual ( 3 ) ;
112118 expect ( paginator . totalRecords ) . toEqual ( gridEl . data . length ) ;
113119 } ) ;
120+
121+ it ( `should initialize pivot grid with state persistence component` , async ( ) => {
122+ const gridEl = document . createElement ( "igc-pivot-grid" ) ;
123+
124+ const stateComponent = document . createElement ( "igc-grid-state" ) ;
125+
126+ gridEl . appendChild ( stateComponent ) ;
127+
128+ testContainer . appendChild ( gridEl ) ;
129+
130+ // TODO: Better way to wait - potentially expose the queue or observable for update on the strategy
131+ await firstValueFrom ( timer ( 10 /* SCHEDULE_DELAY */ * 2 ) ) ;
132+ expect ( ( ) => stateComponent . getStateAsString ( ) ) . not . toThrow ( ) ;
133+ } ) ;
114134 } ) ;
115135} ) ;
0 commit comments