[ADF-3298] Select CardView item label removed (#3555)

* placeholder removed

* test added
This commit is contained in:
Alex Bolboșenco
2018-07-03 22:04:11 +03:00
committed by Eugenio Romano
parent ef866fdbdb
commit 1bba43af8c
3 changed files with 11 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
<div *ngIf="!isEditable()" data-automation-class="read-only-value">{{ property.displayValue | async }}</div> <div *ngIf="!isEditable()" data-automation-class="read-only-value">{{ property.displayValue | async }}</div>
<div *ngIf="isEditable()"> <div *ngIf="isEditable()">
<mat-form-field> <mat-form-field>
<mat-select placeholder="{{ property.label | translate }}" [(value)]="value" (change)="onChange($event)" data-automation-class="select-box"> <mat-select [(value)]="value" (change)="onChange($event)" data-automation-class="select-box">
<mat-option *ngFor="let option of getOptions() | async" [value]="option.key"> <mat-option *ngFor="let option of getOptions() | async" [value]="option.key">
{{ option.label | translate }} {{ option.label | translate }}
</mat-option> </mat-option>

View File

@@ -87,6 +87,15 @@ describe('CardViewSelectItemComponent', () => {
expect(selectBox).not.toBeNull(); expect(selectBox).not.toBeNull();
}); });
it('should not have label twice', () => {
component.ngOnChanges();
component.editable = true;
fixture.detectChanges();
const label = fixture.debugElement.query(By.css('[data-automation-class="select-box"] .mat-form-field-label'));
expect(label).toBeNull();
});
it('should update property on input blur', async(() => { it('should update property on input blur', async(() => {
spyOn(cardViewUpdateService, 'update'); spyOn(cardViewUpdateService, 'update');

View File

@@ -21,7 +21,7 @@ import { CardViewSelectItemProperties } from '../interfaces/card-view.interfaces
import { of } from 'rxjs/observable/of'; import { of } from 'rxjs/observable/of';
describe('CardViewSelectItemModel', () => { describe('CardViewSelectItemModel', () => {
let properties: CardViewSelectItemProperties; let properties: CardViewSelectItemProperties<string>;
const mockData = [{ key: 'one', label: 'One' }, { key: 'two', label: 'Two' }, { key: 'three', label: 'Three' }]; const mockData = [{ key: 'one', label: 'One' }, { key: 'two', label: 'Two' }, { key: 'three', label: 'Three' }];
beforeEach(() => { beforeEach(() => {