Skip to content

Commit

Permalink
refactor(igxMask): cleanup/streamline parsing and input handling
Browse files Browse the repository at this point in the history
- input parsing go through one method
- add drag and drop functionality
- set default value on mask prop
  • Loading branch information
jackofdiamond5 committed Feb 25, 2020
1 parent d4c72f9 commit 397d5b8
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 535 deletions.
9 changes: 8 additions & 1 deletion projects/igniteui-angular/src/lib/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,14 @@ export const enum KEYCODES {
RIGHT_ARROW = 39,
DOWN_ARROW = 40,
F2 = 113,
TAB = 9
TAB = 9,
CTRL = 17,
Z = 90,
Y = 89,
X = 88,
BACKSPACE = 8,
DELETE = 46,
INPUT_METHOD = 229
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, ViewChild, ElementRef } from '@angular/core';
import { async, fakeAsync, TestBed, tick, flush, ComponentFixture } from '@angular/core/testing';
import { FormsModule, FormGroup, FormBuilder, FormControl, ReactiveFormsModule} from '@angular/forms';
import { FormsModule, FormGroup, FormBuilder, FormControl, ReactiveFormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { IgxDatePickerComponent, IgxDatePickerModule } from './date-picker.component';
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('IgxDatePicker', () => {
expect(input).toEqual(document.activeElement);
}));

it('When a modal datepicker is closed via outside click, the focus should remain on the input',
it('When a modal datepicker is closed via outside click, the focus should remain on the input',
fakeAsync(() => {
const datePickerDom = fixture.debugElement.query(By.css('igx-date-picker'));
let overlayToggle = document.getElementsByClassName('igx-overlay__wrapper--modal');
Expand All @@ -230,7 +230,7 @@ describe('IgxDatePicker', () => {
expect(input).toEqual(document.activeElement);
}));

it('When datepicker is closed upon selecting a date, the focus should remain on the input',
it('When datepicker is closed upon selecting a date, the focus should remain on the input',
fakeAsync(() => {
const datePickerDom = fixture.debugElement.query(By.css('igx-date-picker'));
let overlayToggle = document.getElementsByClassName('igx-overlay__wrapper--modal');
Expand Down Expand Up @@ -1149,7 +1149,8 @@ describe('IgxDatePicker', () => {
expect(input).toBeDefined();
datePicker.isSpinLoop = false;

input.nativeElement.focus();
input.triggerEventHandler('focus', {});
fixture.detectChanges(); // bound transformedDate assign
UIInteractions.sendInput(input, '31-03-19');
expect(input.nativeElement.value).toBe('31-03-19');

Expand Down
Loading

0 comments on commit 397d5b8

Please sign in to comment.