Skip to content

Commit

Permalink
Test(LocaleNumberValidatorDirective): add rtl test
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed May 1, 2017
1 parent 668d0a5 commit 7845742
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,29 @@ describe('LocaleNumberValidatorDirective', () => {
});
}));

it('should validate right to left', async(() => {
locale.setDefaultLocale('ar', 'SA');

comp.decimal = "٣٫١٤";

fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();

const form: NgForm = fixture.debugElement.children[0].injector.get(NgForm);
const control: AbstractControl | null = form.control.get('decimal');

if (control) {
expect(control.valid).toBe(true);
expect(control.hasError('format')).toBe(false);
expect(control.hasError('minValue')).toBe(false);
expect(control.hasError('maxValue')).toBe(false);
} else {
throw new Error("Control is null");
}
});
}));

});

@Component({
Expand Down

0 comments on commit 7845742

Please sign in to comment.