});
it('should return undefined (no selection)', () => {
- expect(component.getEditDisableDesc()).toBeUndefined();
+ expect(component.getEditDisableDesc(component.selection)).toBeUndefined();
});
it('should return undefined (managed by Orchestrator)', () => {
orchestrator: true
}
});
- expect(component.getEditDisableDesc()).toBeUndefined();
+ expect(component.getEditDisableDesc(component.selection)).toBeUndefined();
});
});
});
},
disable: (selection: CdTableSelection) =>
!selection.hasSingleSelection || !selection.first().sources.orchestrator,
- disableDesc: () => this.getEditDisableDesc()
+ disableDesc: this.getEditDisableDesc.bind(this)
},
{
name: this.actionLabels.DELETE,
});
}
- getEditDisableDesc(): string | undefined {
- if (
- this.selection &&
- this.selection.hasSingleSelection &&
- !this.selection.first().sources.orchestrator
- ) {
+ getEditDisableDesc(selection: CdTableSelection): string | undefined {
+ if (selection && selection.hasSingleSelection && !selection.first().sources.orchestrator) {
return this.i18n('Host editing is disabled because the host is not managed by Orchestrator.');
}
return undefined;