mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[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:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
.mat-input-placeholder {
|
.mat-input-placeholder {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -75,10 +75,6 @@
|
|||||||
|
|
||||||
.mat-focused {
|
.mat-focused {
|
||||||
|
|
||||||
.mat-input-placeholder-wrapper {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
label {
|
||||||
transform: scaleX(1);
|
transform: scaleX(1);
|
||||||
transition: transform 150ms linear,
|
transition: transform 150ms linear,
|
||||||
|
@@ -150,6 +150,17 @@ describe('TextWidgetComponent', () => {
|
|||||||
expect(inputElement.placeholder).toBe('simple palceholder');
|
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(() => {
|
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();
|
expect(element.querySelector('#text-id')).not.toBeNull();
|
||||||
|
|
||||||
@@ -257,6 +268,8 @@ describe('TextWidgetComponent', () => {
|
|||||||
|
|
||||||
describe('and a mask placeholder is configured', () => {
|
describe('and a mask placeholder is configured', () => {
|
||||||
|
|
||||||
|
let inputElement: HTMLInputElement;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
widget.field = new FormFieldModel(new FormModel({taskId: 'fake-task-id'}), {
|
widget.field = new FormFieldModel(new FormModel({taskId: 'fake-task-id'}), {
|
||||||
id: 'text-id',
|
id: 'text-id',
|
||||||
@@ -269,14 +282,25 @@ describe('TextWidgetComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
inputElement = <HTMLInputElement> element.querySelector('#text-id');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the input mask placeholder', () => {
|
it('should show the input mask placeholder', () => {
|
||||||
const inputElement: HTMLInputElement = <HTMLInputElement> element.querySelector('#text-id');
|
|
||||||
expect(inputElement).toBeDefined();
|
expect(inputElement).toBeDefined();
|
||||||
expect(inputElement).not.toBeNull();
|
expect(inputElement).not.toBeNull();
|
||||||
expect(inputElement.placeholder).toBe('Phone : (__) ___-___');
|
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 : (__) ___-___');
|
||||||
|
});
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -39,9 +39,9 @@ export class TextWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field.params && this.field.params['inputMask']) {
|
if (this.field.params) {
|
||||||
this.mask = this.field.params['inputMask'];
|
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;
|
this.isMaskReversed = this.field.params['inputMaskReversed'] ? this.field.params['inputMaskReversed'] : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user