[ADF-2607] Task Form - Number Widget placeholder no longer displayed (#3165)

* [ADF-2607] Task Form - Number Widget placeholder no longer displayed

* Removed css to display placeholder after focus on input.

* [ADF-2607] Task Form - Number Widget placeholder no longer displayed.

Changed test cases and placeholder value in amount and text widgets.
This commit is contained in:
camorra-skk
2018-04-11 18:02:55 +05:30
committed by Vito
parent 5f8b41411a
commit 82da1f80b3
4 changed files with 28 additions and 7 deletions

View File

@@ -16,6 +16,7 @@
.mat-input-placeholder {
margin-top: 5px;
display: none;
}
}

View File

@@ -75,10 +75,6 @@
.mat-focused {
.mat-input-placeholder-wrapper {
display: none;
}
label {
transform: scaleX(1);
transition: transform 150ms linear,

View File

@@ -150,6 +150,17 @@ describe('TextWidgetComponent', () => {
expect(inputElement.placeholder).toBe('simple palceholder');
});
it('should show the field placeholder when clicked', async(() => {
inputElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(inputElement).toBeDefined();
expect(inputElement).not.toBeNull();
expect(inputElement.placeholder).toBe('simple palceholder');
});
}));
it('should prevent text to be written if is not allowed by the mask on keyUp event', async(() => {
expect(element.querySelector('#text-id')).not.toBeNull();
@@ -257,6 +268,8 @@ describe('TextWidgetComponent', () => {
describe('and a mask placeholder is configured', () => {
let inputElement: HTMLInputElement;
beforeEach(() => {
widget.field = new FormFieldModel(new FormModel({taskId: 'fake-task-id'}), {
id: 'text-id',
@@ -269,14 +282,25 @@ describe('TextWidgetComponent', () => {
});
fixture.detectChanges();
inputElement = <HTMLInputElement> element.querySelector('#text-id');
});
it('should show the input mask placeholder', () => {
const inputElement: HTMLInputElement = <HTMLInputElement> element.querySelector('#text-id');
expect(inputElement).toBeDefined();
expect(inputElement).not.toBeNull();
expect(inputElement.placeholder).toBe('Phone : (__) ___-___');
});
it('should show the input mask placeholder when clicked', async(() => {
inputElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(inputElement).toBeDefined();
expect(inputElement).not.toBeNull();
expect(inputElement.placeholder).toBe('Phone : (__) ___-___');
});
}));
});
});
});

View File

@@ -39,9 +39,9 @@ export class TextWidgetComponent extends WidgetComponent implements OnInit {
}
ngOnInit() {
if (this.field.params && this.field.params['inputMask']) {
if (this.field.params) {
this.mask = this.field.params['inputMask'];
this.placeholder = this.field.params['inputMaskPlaceholder'] ? this.field.params['inputMaskPlaceholder'] : this.field.placeholder;
this.placeholder = this.field.params['inputMask'] && this.field.params['inputMaskPlaceholder'] ? this.field.params['inputMaskPlaceholder'] : this.field.placeholder;
this.isMaskReversed = this.field.params['inputMaskReversed'] ? this.field.params['inputMaskReversed'] : false;
}
}