mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[TLC-254] Service tests - small fixes
This commit is contained in:
@@ -199,22 +199,20 @@ export class DsDynamicTypeBindRelationService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Build up the subscriptions to watch for changes;
|
// Build up the subscriptions to watch for changes;
|
||||||
if (hasValue(this.dynamicMatchers) || true) {
|
subscriptions.push(valueChanges.subscribe(() => {
|
||||||
subscriptions.push(valueChanges.subscribe(() => {
|
// Iterate each matcher
|
||||||
// Iterate each matcher
|
if (hasValue(this.dynamicMatchers)) {
|
||||||
this.dynamicMatchers.forEach((matcher) => {
|
this.dynamicMatchers.forEach((matcher) => {
|
||||||
|
|
||||||
// Find the relation
|
// Find the relation
|
||||||
const relation = this.dynamicFormRelationService.findRelationByMatcher((model as any).typeBindRelations, matcher);
|
const relation = this.dynamicFormRelationService.findRelationByMatcher((model as any).typeBindRelations, matcher);
|
||||||
|
|
||||||
// If the relation is defined, get matchesCondition result and pass it to the onChange event listener
|
// If the relation is defined, get matchesCondition result and pass it to the onChange event listener
|
||||||
if (relation !== undefined) {
|
if (relation !== undefined) {
|
||||||
const hasMatch = this.matchesCondition(relation, matcher);
|
const hasMatch = this.matchesCondition(relation, matcher);
|
||||||
matcher.onChange(hasMatch, model, control, this.injector);
|
matcher.onChange(hasMatch, model, control, this.injector);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
}
|
||||||
}
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -38,14 +38,11 @@ export class DynamicDsDatePickerModel extends DynamicDateControlModel {
|
|||||||
this.typeBindRelations = config.typeBindRelations ? config.typeBindRelations : [];
|
this.typeBindRelations = config.typeBindRelations ? config.typeBindRelations : [];
|
||||||
this.hiddenUpdates = new BehaviorSubject<boolean>(this.hidden);
|
this.hiddenUpdates = new BehaviorSubject<boolean>(this.hidden);
|
||||||
|
|
||||||
// Asynchronously hide parent if this is hidden
|
// This was a subscription, then an async setTimeout, but it seems unnecessary
|
||||||
setTimeout((hidden: boolean) => {
|
const parentModel = this.getRootParent(this);
|
||||||
this.hidden = hidden;
|
if (parentModel && isNotUndefined(parentModel.hidden)) {
|
||||||
const parentModel = this.getRootParent(this);
|
parentModel.hidden = this.hidden;
|
||||||
if (parentModel && isNotUndefined(parentModel.hidden)) {
|
}
|
||||||
parentModel.hidden = hidden;
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getRootParent(model: any): DynamicFormControlModel {
|
private getRootParent(model: any): DynamicFormControlModel {
|
||||||
|
Reference in New Issue
Block a user