Skip to content

Commit 3908350

Browse files
Merge pull request #14575 from IgniteUI/aahmedov/fix-searchValueInputFocus-14521-18.1.x
fix(query-builder): Fix for dateTime's searchValueInput focus -18.1.x
2 parents 2f0d40a + 0c04ede commit 3908350

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-advanced.spec.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3113,9 +3113,39 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
31133113
GridFunctions.clickAdvancedFilteringColumnSelect(fix);
31143114
fix.detectChanges();
31153115
const dropdownValues = GridFunctions.getAdvancedFilteringSelectDropdownItems(fix).map((x: any) => x.innerText);
3116-
const expectedValues = ['ID', 'ProductName', 'Downloads', 'Released', 'ReleaseDate', 'Another Field'];
3116+
const expectedValues = ['ID', 'ProductName', 'Downloads', 'Released', 'ReleaseDate', 'Another Field', 'DateTimeCreated'];
31173117
expect(expectedValues).toEqual(dropdownValues);
31183118
}));
3119+
3120+
it('Should correctly focus the search value input when editing the filtering expression', fakeAsync(() => {
3121+
// Open dialog through API.
3122+
grid.openAdvancedFilteringDialog();
3123+
fix.detectChanges();
3124+
3125+
//Create dateTime filtering expression
3126+
const tree = new FilteringExpressionsTree(FilteringLogic.And);
3127+
tree.filteringOperands.push({
3128+
fieldName: 'DateTimeCreated', searchVal: '11/11/2000 10:11:11 AM', condition: IgxStringFilteringOperand.instance().condition('equals')
3129+
});
3130+
3131+
grid.advancedFilteringExpressionsTree = tree;
3132+
fix.detectChanges();
3133+
3134+
// Hover the last visible expression chip
3135+
const expressionItem = fix.nativeElement.querySelectorAll(`.${ADVANCED_FILTERING_EXPRESSION_ITEM_CLASS}`)[0];
3136+
expressionItem.dispatchEvent(new MouseEvent('mouseenter'));
3137+
tick();
3138+
fix.detectChanges();
3139+
3140+
// Click the edit icon to enter edit mode of the expression.
3141+
GridFunctions.clickAdvancedFilteringTreeExpressionChipEditIcon(fix, [0]);
3142+
tick();
3143+
fix.detectChanges();
3144+
3145+
//Check for the active element
3146+
let searchValueInput = GridFunctions.getAdvancedFilteringValueInput(fix).querySelector('input');
3147+
expect(document.activeElement).toBe(searchValueInput, 'The input should be the active element.');
3148+
}));
31193149
});
31203150

31213151
describe('External - ', () => {

projects/igniteui-angular/src/lib/query-builder/query-builder.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ <h6 class="igx-filter-empty__title">
338338
>
339339
<input
340340
#input
341+
#searchValueInput
341342
igxInput
342343
tabindex="0"
343344
[placeholder]="

projects/igniteui-angular/src/lib/test-utils/grid-samples.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,8 +1278,8 @@ export class IgxGridExternalAdvancedFilteringComponent extends BasicGridComponen
12781278
<igx-column width="100px" [field]="'Released'" dataType="boolean"></igx-column>
12791279
<igx-column width="100px" [field]="'ReleaseDate'" dataType="date" headerClasses="header-release-date"></igx-column>
12801280
</igx-column-group>
1281-
<igx-column width="100px" [field]="'AnotherField'" [header]="'Another Field'" dataType="string" [filters]="customFilter">
1282-
</igx-column>
1281+
<igx-column width="100px" [field]="'AnotherField'" [header]="'Another Field'" dataType="string" [filters]="customFilter"></igx-column>
1282+
<igx-column width="100px" [field]="'DateTimeCreated'" dataType="dateTime"></igx-column>
12831283
</igx-grid>`,
12841284
standalone: true,
12851285
imports: [IgxGridComponent, IgxColumnComponent, IgxColumnGroupComponent]

0 commit comments

Comments
 (0)