@@ -38,6 +38,7 @@ import {
3838 ResizeStrategy ,
3939} from '@uipath/angular/components/ui-grid' ;
4040import {
41+ ISuggestValueData ,
4142 ISuggestValues ,
4243 UiSuggestComponent ,
4344} from '@uipath/angular/components/ui-suggest' ;
@@ -1327,7 +1328,7 @@ describe('Component: UiGrid', () => {
13271328 [searchable]="true"
13281329 title="String Header"
13291330 width="50%">
1330- <ui-grid-search-filter [searchSourceFactory]="searchFactory"></ui-grid-search-filter>
1331+ <ui-grid-search-filter [searchSourceFactory]="searchFactory" [value]="value" [multiple]="multiple" ></ui-grid-search-filter>
13311332 </ui-grid-column>
13321333 </ui-grid>
13331334 ` ,
@@ -1343,6 +1344,9 @@ describe('Component: UiGrid', () => {
13431344 showAllOption ?: boolean ;
13441345 search ?: boolean ;
13451346
1347+ value ?: ISuggestValueData < ITestEntity > [ ] ;
1348+ multiple = false ;
1349+
13461350 searchFactory = ( ) : Observable < ISuggestValues < any > > => of ( {
13471351 data : this . dropdownItemList
13481352 . map (
@@ -1372,7 +1376,7 @@ describe('Component: UiGrid', () => {
13721376 fixture = TestBed . createComponent ( TestFixtureGridHeaderWithFilterComponent ) ;
13731377 component = fixture . componentInstance ;
13741378 grid = component . grid ;
1375- grid . data = generateListFactory ( generateEntity ) ( ) ;
1379+ component . data = generateListFactory ( generateEntity ) ( ) ;
13761380 } ) ;
13771381
13781382 afterEach ( ( ) => {
@@ -1614,6 +1618,26 @@ describe('Component: UiGrid', () => {
16141618
16151619 expect ( searchFilter . items . length ) . toEqual ( 0 ) ;
16161620 } ) ) ;
1621+
1622+ it ( 'should correctly set the initial value' , ( ) => {
1623+ component . multiple = true ;
1624+ component . value = [ {
1625+ id : component . data ?. [ 0 ] ?. id ?? '' ,
1626+ text : component . data ?. [ 0 ] ?. myString ?? '' ,
1627+ } ] ;
1628+
1629+ fixture . detectChanges ( ) ;
1630+
1631+ expect ( grid . filterManager . filter$ . value ) . toEqual ( [ {
1632+ method : undefined as any ,
1633+ property : 'myString' ,
1634+ value : [ component . data ?. [ 0 ] ?. id ?? '' ] as any ,
1635+ meta : [ {
1636+ id : component . data ?. [ 0 ] ?. id ?? '' ,
1637+ text : component . data ?. [ 0 ] ?. myString ?? '' ,
1638+ } ] ,
1639+ } ] ) ;
1640+ } ) ;
16171641 } ) ;
16181642
16191643 describe ( 'Event: dropdown filter change' , ( ) => {
0 commit comments