Skip to content

Commit

Permalink
test(igxMask): detect changes every time value is set #6454
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofdiamond5 committed Feb 7, 2020
1 parent df6a6c9 commit 30f1e33
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IgxInputGroupModule } from '../../input-group/input-group.component';
import { IgxMaskModule } from './mask.directive';

import { configureTestSuite } from '../../test-utils/configure-suite';
import { UIInteractions } from '../../test-utils/ui-interactions.spec';

describe('igxMask', () => {
configureTestSuite();
Expand Down Expand Up @@ -41,7 +42,6 @@ describe('igxMask', () => {
it('Initializes an input with default mask', fakeAsync(() => {
const fixture = TestBed.createComponent(DefMaskComponent);
fixture.detectChanges();

const input = fixture.componentInstance.input;

expect(input.nativeElement.value).toEqual('');
Expand All @@ -51,6 +51,7 @@ describe('igxMask', () => {
tick();

input.nativeElement.value = '@#$YUA123';
fixture.detectChanges();
input.nativeElement.dispatchEvent(new Event('input'));
tick();

Expand Down Expand Up @@ -149,13 +150,13 @@ describe('igxMask', () => {
it('Enter incorrect value with a preset mask', fakeAsync(() => {
const fixture = TestBed.createComponent(MaskComponent);
fixture.detectChanges();

const input = fixture.componentInstance.input;

input.nativeElement.dispatchEvent(new Event('focus'));
tick();

input.nativeElement.value = 'abc4569d12';
fixture.detectChanges();
input.nativeElement.dispatchEvent(new Event('input'));
tick();

Expand All @@ -168,6 +169,7 @@ describe('igxMask', () => {
tick();

input.nativeElement.value = '1111111111111111111';
fixture.detectChanges();
input.nativeElement.dispatchEvent(new Event('input'));
tick();

Expand Down Expand Up @@ -199,6 +201,7 @@ describe('igxMask', () => {
tick();

input.nativeElement.value = '123';
fixture.detectChanges();
input.nativeElement.dispatchEvent(new Event('input'));
tick();

Expand All @@ -225,6 +228,7 @@ describe('igxMask', () => {
expect(comp.value).toEqual(3456);

input.nativeElement.value = 'A';
fixture.detectChanges();
input.nativeElement.dispatchEvent(new Event('input'));
tick();

Expand Down Expand Up @@ -277,6 +281,7 @@ describe('igxMask', () => {
tick();

input.nativeElement.value = '';
fixture.detectChanges();
input.nativeElement.dispatchEvent(new Event('input'));
tick();

Expand All @@ -286,6 +291,7 @@ describe('igxMask', () => {
expect(input.nativeElement.value).toEqual('(___) ____-___');

input.nativeElement.value = '6666';
fixture.detectChanges();
input.nativeElement.dispatchEvent(new Event('input'));
tick();

Expand Down

0 comments on commit 30f1e33

Please sign in to comment.