mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +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;
|
||||
if (hasValue(this.dynamicMatchers) || true) {
|
||||
subscriptions.push(valueChanges.subscribe(() => {
|
||||
// Iterate each matcher
|
||||
if (hasValue(this.dynamicMatchers)) {
|
||||
this.dynamicMatchers.forEach((matcher) => {
|
||||
|
||||
// Find the relation
|
||||
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 (relation !== undefined) {
|
||||
const hasMatch = this.matchesCondition(relation, matcher);
|
||||
matcher.onChange(hasMatch, model, control, this.injector);
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -38,14 +38,11 @@ export class DynamicDsDatePickerModel extends DynamicDateControlModel {
|
||||
this.typeBindRelations = config.typeBindRelations ? config.typeBindRelations : [];
|
||||
this.hiddenUpdates = new BehaviorSubject<boolean>(this.hidden);
|
||||
|
||||
// Asynchronously hide parent if this is hidden
|
||||
setTimeout((hidden: boolean) => {
|
||||
this.hidden = hidden;
|
||||
// This was a subscription, then an async setTimeout, but it seems unnecessary
|
||||
const parentModel = this.getRootParent(this);
|
||||
if (parentModel && isNotUndefined(parentModel.hidden)) {
|
||||
parentModel.hidden = hidden;
|
||||
parentModel.hidden = this.hidden;
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private getRootParent(model: any): DynamicFormControlModel {
|
||||
|
Reference in New Issue
Block a user