Skip to content

Commit d1511e9

Browse files
committed
fix(query-builder): search value input for dateTime focus
1 parent a59767a commit d1511e9

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
@@ -3038,9 +3038,39 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
30383038
GridFunctions.clickAdvancedFilteringColumnSelect(fix);
30393039
fix.detectChanges();
30403040
const dropdownValues = GridFunctions.getAdvancedFilteringSelectDropdownItems(fix).map((x: any) => x.innerText);
3041-
const expectedValues = ['ID', 'ProductName', 'Downloads', 'Released', 'ReleaseDate', 'Another Field'];
3041+
const expectedValues = ['ID', 'ProductName', 'Downloads', 'Released', 'ReleaseDate', 'Another Field', 'DateTimeCreated'];
30423042
expect(expectedValues).toEqual(dropdownValues);
30433043
}));
3044+
3045+
it('Should correctly focus the search value input when editing the filtering expression', fakeAsync(() => {
3046+
// Open dialog through API.
3047+
grid.openAdvancedFilteringDialog();
3048+
fix.detectChanges();
3049+
3050+
//Create dateTime filtering expression
3051+
const tree = new FilteringExpressionsTree(FilteringLogic.And);
3052+
tree.filteringOperands.push({
3053+
fieldName: 'DateTimeCreated', searchVal: '11/11/2000 10:11:11 AM', condition: IgxStringFilteringOperand.instance().condition('equals')
3054+
});
3055+
3056+
grid.advancedFilteringExpressionsTree = tree;
3057+
fix.detectChanges();
3058+
3059+
// Hover the last visible expression chip
3060+
const expressionItem = fix.nativeElement.querySelectorAll(`.${ADVANCED_FILTERING_EXPRESSION_ITEM_CLASS}`)[0];
3061+
expressionItem.dispatchEvent(new MouseEvent('mouseenter'));
3062+
tick();
3063+
fix.detectChanges();
3064+
3065+
// Click the edit icon to enter edit mode of the expression.
3066+
GridFunctions.clickAdvancedFilteringTreeExpressionChipEditIcon(fix, [0]);
3067+
tick();
3068+
fix.detectChanges();
3069+
3070+
//Check for the active element
3071+
let searchValueInput = GridFunctions.getAdvancedFilteringValueInput(fix).querySelector('input');
3072+
expect(document.activeElement).toBe(searchValueInput, 'The input should be the active element.');
3073+
}));
30443074
});
30453075

30463076
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
@@ -1236,8 +1236,8 @@ export class IgxGridExternalAdvancedFilteringComponent extends BasicGridComponen
12361236
<igx-column width="100px" [field]="'Released'" dataType="boolean"></igx-column>
12371237
<igx-column width="100px" [field]="'ReleaseDate'" dataType="date" headerClasses="header-release-date"></igx-column>
12381238
</igx-column-group>
1239-
<igx-column width="100px" [field]="'AnotherField'" [header]="'Another Field'" dataType="string" [filters]="customFilter">
1240-
</igx-column>
1239+
<igx-column width="100px" [field]="'AnotherField'" [header]="'Another Field'" dataType="string" [filters]="customFilter"></igx-column>
1240+
<igx-column width="100px" [field]="'DateTimeCreated'" dataType="dateTime"></igx-column>
12411241
</igx-grid>`,
12421242
standalone: true,
12431243
imports: [IgxGridComponent, IgxColumnComponent, IgxColumnGroupComponent]

0 commit comments

Comments
 (0)