71894: WIP: fix EditInPlace tests

This commit is contained in:
Marie Verdonck
2020-07-22 17:28:45 +02:00
parent 4a0444d669
commit 2ebb1640b4
4 changed files with 8 additions and 4 deletions

View File

@@ -5,7 +5,7 @@
</div>
<div *ngIf="(editable | async)" class="field-container">
<ds-filter-input-suggestions [suggestions]="(metadataFieldSuggestions | async)"
[(ngModel)]="metadata.key"
[(ngModel)]="metadata.key"
(submitSuggestion)="update(suggestionControl)"
(clickSuggestion)="update(suggestionControl)"
(typeSuggestion)="update(suggestionControl)"
@@ -17,6 +17,8 @@
[ngModelOptions]="{standalone: true}"
></ds-filter-input-suggestions>
</div>
<small class="text-danger"
*ngIf="(valid | async) === false">{{"item.edit.metadata.metadatafield.invalid" | translate}}</small>
</div>
</td>
<td class="w-100">

View File

@@ -17,6 +17,7 @@ import { MetadatumViewModel } from '../../../../core/shared/metadata.models';
import { InputSuggestion } from '../../../../shared/input-suggestions/input-suggestions.model';
import { SharedModule } from '../../../../shared/shared.module';
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
import { followLink } from '../../../../shared/utils/follow-link-config.model';
import { EditInPlaceFieldComponent } from './edit-in-place-field.component';
let comp: EditInPlaceFieldComponent;
@@ -57,7 +58,7 @@ const fieldUpdate = {
};
let scheduler: TestScheduler;
fdescribe('EditInPlaceFieldComponent', () => {
describe('EditInPlaceFieldComponent', () => {
beforeEach(async(() => {
scheduler = getTestScheduler();
@@ -211,7 +212,7 @@ fdescribe('EditInPlaceFieldComponent', () => {
it('it should call queryMetadataFields on the metadataFieldService with the correct query', () => {
expect(metadataFieldService.queryMetadataFields).toHaveBeenCalledWith(query);
expect(metadataFieldService.queryMetadataFields).toHaveBeenCalledWith(query, null, followLink('schema'));
});
it('it should set metadataFieldSuggestions to the right value', () => {

View File

@@ -8,6 +8,7 @@
[ngClass]="{'is-invalid': !valid}"
[dsDebounce]="debounceTime" (onDebounce)="find($event)"
[placeholder]="placeholder"
ng-model-options="{standalone: true}"
autocomplete="off">
<input type="submit" class="d-none"/>
<small class="text-danger"

View File

@@ -37,7 +37,7 @@ export class FilterInputSuggestionsComponent extends InputSuggestionsComponent i
ngOnInit() {
this.form = new FormGroup({
metadataNameField: new FormControl('', {
metadataNameField: new FormControl(this._value, {
asyncValidators: [this.metadataFieldValidator.validate.bind(this.metadataFieldValidator)],
validators: [Validators.required]
})