mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[ADF-673] - text widget value is not updated when the mask is not applied (#1900)
This commit is contained in:
parent
10b310288a
commit
2b755d7ee4
@ -70,6 +70,8 @@ export class InputMaskDirective implements OnChanges, ControlValueAccessor {
|
||||
if (this.inputMask && this.inputMask.mask) {
|
||||
this.maskValue(this.el.nativeElement.value, this.el.nativeElement.selectionStart,
|
||||
this.inputMask.mask, this.inputMask.isReversed, event.keyCode);
|
||||
} else {
|
||||
this._onChange(this.el.nativeElement.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,36 @@ describe('TextWidget', () => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
describe('and no mask is configured on text element', () => {
|
||||
|
||||
let inputElement: HTMLInputElement;
|
||||
|
||||
beforeEach(() => {
|
||||
textWidget.field = new FormFieldModel(new FormModel({ taskId: 'fake-task-id' }), {
|
||||
id: 'text-id',
|
||||
name: 'text-name',
|
||||
value: '',
|
||||
type: FormFieldTypes.TEXT,
|
||||
readOnly: false
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
inputElement = <HTMLInputElement>element.querySelector('#text-id');
|
||||
});
|
||||
|
||||
it('should raise ngModelChange event', async(() => {
|
||||
inputElement.value = 'TEXT';
|
||||
expect(textWidget.field.value).toBe('');
|
||||
inputElement.dispatchEvent(new Event('input'));
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(textWidget.field).not.toBeNull();
|
||||
expect(textWidget.field.value).not.toBeNull();
|
||||
expect(textWidget.field.value).toBe('TEXT');
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('and mask is configured on text element', () => {
|
||||
|
||||
let inputElement: HTMLInputElement;
|
||||
|
Loading…
x
Reference in New Issue
Block a user