From 7845742dcc450480f976bbfc162f198de4cc56b1 Mon Sep 17 00:00:00 2001 From: Roberto Simonetti Date: Mon, 1 May 2017 23:30:14 +0200 Subject: [PATCH] Test(LocaleNumberValidatorDirective): add rtl test --- .../locale-number-validator.directive.spec.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/integration-tests/directives/locale-number-validator.directive.spec.ts b/integration-tests/directives/locale-number-validator.directive.spec.ts index 5e5de59c..48034e55 100644 --- a/integration-tests/directives/locale-number-validator.directive.spec.ts +++ b/integration-tests/directives/locale-number-validator.directive.spec.ts @@ -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({