Skip to content

Commit 69af398

Browse files
committed
fix(selectionDirective): adden number selection
1 parent 5466e65 commit 69af398

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

projects/igniteui-angular/src/lib/directives/text-selection/text-selection.directive.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ describe('IgxSelection', () => {
5151
});
5252

5353
it('Shouldn\'t make a selection when the state is set to false', async () => {
54+
const fix = TestBed.createComponent(TriggerTextSelectionOnClickComponent);
55+
fix.detectChanges();
56+
57+
const input = fix.debugElement.query(By.css('input'));
58+
const inputType = (input.nativeElement as HTMLInputElement).type;
59+
let inputList = ["email", "number", "password", "tel", "text", "url"];
60+
expect(inputList.indexOf(inputType));
61+
});
62+
63+
fit('Should check if the input type is adequate for text selection', async () => {
5464
const fix = TestBed.createComponent(TriggerTextSelectionFalseOnClickComponent);
5565
fix.detectChanges();
5666

projects/igniteui-angular/src/lib/directives/text-selection/text-selection.directive.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ export class IgxTextSelectionDirective {
105105
* }
106106
* ```
107107
*/
108+
108109
public trigger() {
109110
if (this.selected && this.nativeElement.value.length) {
110-
requestAnimationFrame(() => this.nativeElement.setSelectionRange(0, this.nativeElement.value.length));
111+
requestAnimationFrame(() => {
112+
this.nativeElement.select();
113+
})
111114
}
112115
}
113116
}

0 commit comments

Comments
 (0)