mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +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 {
|
||||
margin-top: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -75,10 +75,6 @@
|
||||
|
||||
.mat-focused {
|
||||
|
||||
.mat-input-placeholder-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
label {
|
||||
transform: scaleX(1);
|
||||
transition: transform 150ms linear,
|
||||
|
@@ -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 : (__) ___-___');
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user