mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
[ADF-5223] Fix Amount widget styling (#6302)
* [ADF-5223] Fix Amount widget styling * Fix unit test * Fix e2e test * Fix e2e test
This commit is contained in:
parent
a7510b9800
commit
91b7458bee
@ -74,7 +74,8 @@ describe('Amount Widget', () => {
|
|||||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||||
await expect(await widget.amountWidget().getAmountFieldLabel(app.FIELD.amount_input_id)).toContain('Amount');
|
await expect(await widget.amountWidget().getAmountFieldLabel(app.FIELD.amount_input_id)).toContain('Amount');
|
||||||
await expect(await widget.amountWidget().getPlaceholder(app.FIELD.amount_input_id)).toContain('Type amount');
|
await expect(await widget.amountWidget().getPlaceholder(app.FIELD.amount_input_id)).toContain('Type amount');
|
||||||
await expect(await widget.amountWidget().getAmountFieldCurrency(app.FIELD.amount_input_id)).toBe('$');
|
const fieldCurrency = await widget.amountWidget().getAmountFieldCurrency(app.FIELD.amount_input_id);
|
||||||
|
await expect(fieldCurrency.trim()).toBe('$');
|
||||||
|
|
||||||
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 4);
|
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 4);
|
||||||
await expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe('Can\'t be less than 5');
|
await expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe('Can\'t be less than 5');
|
||||||
|
@ -1,21 +1,25 @@
|
|||||||
<div class="adf-amount-widget__container adf-amount-widget {{field.className}}" [class.adf-invalid]="!field.isValid" [class.adf-readonly]="field.readOnly">
|
<div class="adf-amount-widget__container adf-amount-widget {{field.className}}"
|
||||||
<mat-form-field class="adf-amount-widget__input" floatLabel="never">
|
[class.adf-invalid]="!field.isValid"
|
||||||
<label class="adf-label" [attr.for]="field.id">{{field.name | translate }}<span *ngIf="isRequired()">*</span></label>
|
[class.adf-readonly]="field.readOnly">
|
||||||
<span matPrefix class="adf-amount-widget__prefix-spacing">{{ currency }}</span>
|
<label class="adf-label"
|
||||||
|
[attr.for]="field.id">{{field.name | translate }}<span *ngIf="isRequired()">*</span></label>
|
||||||
|
<mat-form-field class="adf-amount-widget__input">
|
||||||
|
<span matPrefix class="adf-amount-widget__prefix-spacing">{{ currency }} </span>
|
||||||
<input matInput
|
<input matInput
|
||||||
[matTooltip]="field.tooltip"
|
[matTooltip]="field.tooltip"
|
||||||
matTooltipPosition="above"
|
matTooltipPosition="above"
|
||||||
matTooltipShowDelay="1000"
|
matTooltipShowDelay="1000"
|
||||||
class="adf-input"
|
class="adf-input"
|
||||||
type="text"
|
type="text"
|
||||||
[id]="field.id"
|
[id]="field.id"
|
||||||
[required]="isRequired()"
|
[required]="isRequired()"
|
||||||
[placeholder]="placeholder"
|
[placeholder]="placeholder"
|
||||||
[value]="field.value"
|
[value]="field.value"
|
||||||
[(ngModel)]="field.value"
|
[(ngModel)]="field.value"
|
||||||
(ngModelChange)="onFieldChanged(field)"
|
(ngModelChange)="onFieldChanged(field)"
|
||||||
[disabled]="field.readOnly">
|
[disabled]="field.readOnly">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<error-widget [error]="field.validationSummary" ></error-widget>
|
<error-widget [error]="field.validationSummary"></error-widget>
|
||||||
<error-widget *ngIf="isInvalidFieldRequired()" required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget>
|
<error-widget *ngIf="isInvalidFieldRequired()"
|
||||||
|
required="{{ 'FORM.FIELD.REQUIRED' | translate }}"></error-widget>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,20 +6,11 @@
|
|||||||
.adf {
|
.adf {
|
||||||
&-amount-widget {
|
&-amount-widget {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-top: 15px;
|
||||||
.mat-input-element {
|
|
||||||
margin-left: 13px;
|
|
||||||
margin-right: 13px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-amount-widget__container .mat-form-field-label-wrapper {
|
|
||||||
top: 17px;
|
|
||||||
left: 12px;
|
|
||||||
right: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-amount-widget__input {
|
&-amount-widget__input {
|
||||||
|
margin-top: -15px;
|
||||||
|
|
||||||
.mat-focused {
|
.mat-focused {
|
||||||
transition: none;
|
transition: none;
|
||||||
@ -31,10 +22,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-amount-widget__prefix-spacing {
|
|
||||||
position: absolute;
|
|
||||||
top: 12px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ describe('AmountWidgetComponent - rendering', () => {
|
|||||||
const widgetLabel = fixture.nativeElement.querySelector('label.adf-label');
|
const widgetLabel = fixture.nativeElement.querySelector('label.adf-label');
|
||||||
expect(widgetLabel.textContent).toBe('Test Amount*');
|
expect(widgetLabel.textContent).toBe('Test Amount*');
|
||||||
const widgetPrefix = fixture.nativeElement.querySelector('div.mat-form-field-prefix');
|
const widgetPrefix = fixture.nativeElement.querySelector('div.mat-form-field-prefix');
|
||||||
expect(widgetPrefix.textContent).toBe('$');
|
expect(widgetPrefix.textContent.trim()).toBe('$');
|
||||||
expect(widget.field.isValid).toBe(false);
|
expect(widget.field.isValid).toBe(false);
|
||||||
const widgetById: HTMLInputElement = fixture.nativeElement.querySelector('#TestAmount1');
|
const widgetById: HTMLInputElement = fixture.nativeElement.querySelector('#TestAmount1');
|
||||||
expect(widgetById).toBeDefined();
|
expect(widgetById).toBeDefined();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user