Skip to content

Commit 8222819

Browse files
authored
Merge branch 'master' into puppeteer
2 parents 7fdfcb3 + e5e95ba commit 8222819

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes for each version of this project will be documented in this
77
### New Features
88
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`:
99
- `GroupMemberCountSortingStrategy` is added, which can be used to sort the grid by number of items in each group in ASC or DESC order, if grouping is applied.
10+
- A new argument `primaryKey` has been introduced to `IRowDataEventArgs` Interface and part of the event arguments that are emitted by the `rowAdded` and `rowDeleted` events. When the grid has a primary key attribute added, then the emitted `primaryKey` event argument represents the row ID, otherwise it defaults to undefined.
1011
- `IgxColumnComponent`
1112
- Added `currRec` and `groupRec` parameters to the `groupingComparer` function that give access to the all properties of the compared records.
1213

projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
[attr.aria-describedby]="ariaDescribeBy"
7979
[attr.aria-invalid]="isInvalid"
8080
[igxFocus]="true"
81+
[igxTextSelection]="true"
8182
[formControl]="formControl"
8283
(compositionstart)="grid.crudService.isInCompositionMode = true"
8384
(compositionend)="grid.crudService.isInCompositionMode = false"
@@ -93,6 +94,7 @@
9394
[igxFocus]="true"
9495
[step]="step"
9596
type="number"
97+
[igxTextSelection]="true"
9698
[formControl]="formControl"
9799
/>
98100
</igx-input-group>
@@ -153,6 +155,7 @@
153155
[igxFocus]="true"
154156
[step]="step"
155157
type="number"
158+
[igxTextSelection]="true"
156159
[formControl]="formControl"
157160
/>
158161
<igx-suffix *ngIf="!grid.currencyPositionLeft">{{ currencyCodeSymbol }}</igx-suffix>
@@ -167,6 +170,7 @@
167170
[igxFocus]="true"
168171
[step]="step"
169172
type="number"
173+
[igxTextSelection]="true"
170174
[formControl]="formControl"
171175
/>
172176
<igx-suffix> {{ editValue | percent:column.pipeArgs.digitsInfo:grid.locale }} </igx-suffix>

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-integration.spec.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TestBed, ComponentFixture, waitForAsync } from '@angular/core/testing';
1+
import { TestBed, ComponentFixture, waitForAsync, fakeAsync, tick } from '@angular/core/testing';
22
import { DebugElement } from '@angular/core';
33
import { IgxTreeGridComponent } from './tree-grid.component';
44
import { CellType, IgxTreeGridModule } from './public_api';
@@ -593,6 +593,30 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
593593
const editedParentCell = parentRow.cells.filter(c => c.column.field === 'Age')[0];
594594
expect(editedParentCell.value).toEqual(80);
595595
});
596+
597+
it('should select the text when the first cell (tree grid cell) enters edit mode', fakeAsync(() => {
598+
const grid = fix.componentInstance.treeGrid as IgxTreeGridComponent;
599+
grid.expandAll();
600+
fix.detectChanges();
601+
602+
// move the 'string' column 'Name' to first position, so its cells are the tree grid cells
603+
const colName = grid.getColumnByName('Name');
604+
const colHireDate = grid.getColumnByName('HireDate');
605+
grid.moveColumn(colName, colHireDate, DropPosition.BeforeDropTarget);
606+
fix.detectChanges();
607+
tick(100);
608+
609+
const cell = grid.gridAPI.get_cell_by_index(0, 'Name');
610+
cell.setEditMode(true);
611+
fix.detectChanges();
612+
tick(100);
613+
614+
expect(cell.editMode).toBe(true);
615+
expect(document.activeElement.nodeName).toEqual('INPUT')
616+
expect((document.activeElement as HTMLInputElement).value).toBe('John Winchester');
617+
expect((document.activeElement as HTMLInputElement).selectionStart).toEqual(0);
618+
expect((document.activeElement as HTMLInputElement).selectionEnd).toEqual(15);
619+
}));
596620
});
597621

598622
describe('Batch Editing', () => {

0 commit comments

Comments
 (0)