[AAE-3200] Attach button of content node selector becomes enabled when selecting a folder (#5946)

* [AAE-3200] Attach button of content node selector becomes enabled when selecting a folder

* * Removed  excluded test from the protractor.exludes.json file
This commit is contained in:
siva kumar
2020-08-04 13:51:37 +05:30
committed by GitHub
parent 1ade912e64
commit 88433fe4b9
4 changed files with 21 additions and 5 deletions

View File

@@ -44,7 +44,7 @@
</button>
<button mat-button
[disabled]="!chosenNode"
[disabled]="!hasNodeSelected()"
class="adf-choose-action"
(click)="onClick()"
data-automation-id="content-node-selector-actions-choose">{{ buttonActionName | translate }}

View File

@@ -161,6 +161,22 @@ describe('ContentNodeSelectorDialogComponent', () => {
const actionButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-choose"]'));
expect(actionButton.nativeElement.disabled).toBeFalsy();
});
it('should be disabled when no node chosen', () => {
component.onSelect([new Node({ id: 'fake' })]);
fixture.detectChanges();
const actionButtonWithNodeSelected = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-choose"]'));
expect(actionButtonWithNodeSelected.nativeElement.disabled).toBe(false);
component.onSelect([]);
fixture.detectChanges();
const actionButtonWithoutNodeSelected = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-choose"]'));
expect(actionButtonWithoutNodeSelected.nativeElement.disabled).toBe(true);
});
});
describe('Title', () => {

View File

@@ -82,4 +82,8 @@ export class ContentNodeSelectorComponent {
onError(error) {
this.notificationService.showError(error);
}
hasNodeSelected(): boolean {
return this.chosenNode?.length > 0;
}
}