From 5d5fb299e718ee1a119365ad61061b945da28c5f Mon Sep 17 00:00:00 2001 From: Tomasz Gnyp <49343696+tomgny@users.noreply.github.com> Date: Mon, 8 May 2023 11:49:46 +0200 Subject: [PATCH] =?UTF-8?q?[AAE-12763]=20Unit=20test=20-=20C588832=20Shoul?= =?UTF-8?q?d=20not=20be=20able=20to=20upload=20a=20file=20=E2=80=A6=20(#85?= =?UTF-8?q?12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [AAE-12763] Unit test - C588832 Should not be able to upload a file whilst a search is still running * [AAE-12763] Remove test rail case ID --- .../content-node-selector.component.spec.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts index 0ad72b154b..2f7f1ebd8c 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts @@ -261,6 +261,36 @@ describe('ContentNodeSelectorComponent', () => { describe('Upload button', () => { + it('Should not be able to upload a file whilst a search is still running', () => { + enableLocalUpload(); + fixture.detectChanges(); + + let infoMatIcon = fixture.debugElement.query(By.css('[data-automation-id="adf-content-node-selector-disabled-tab-info-icon"]')); + let uploadFromLocalTab = fixture.debugElement.queryAll(By.css('.mat-tab-label'))[1]; + + expect(uploadFromLocalTab.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(infoMatIcon).toBeFalsy(); + + component.showingSearch = true; + fixture.detectChanges(); + + uploadFromLocalTab = fixture.debugElement.queryAll(By.css('.mat-tab-label'))[1]; + infoMatIcon = fixture.debugElement.query(By.css('[data-automation-id="adf-content-node-selector-disabled-tab-info-icon"]')); + + expect(uploadFromLocalTab.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(infoMatIcon).toBeTruthy(); + expect(component.getWarningMessage()).toEqual('NODE_SELECTOR.UPLOAD_BUTTON_SEARCH_WARNING_MESSAGE'); + + component.showingSearch = false; + fixture.detectChanges(); + + uploadFromLocalTab = fixture.debugElement.queryAll(By.css('.mat-tab-label'))[1]; + infoMatIcon = fixture.debugElement.query(By.css('[data-automation-id="adf-content-node-selector-disabled-tab-info-icon"]')); + + expect(uploadFromLocalTab.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(infoMatIcon).toBeFalsy(); + }); + it('should be able to show upload button if showLocalUploadButton set to true', async () => { enableLocalUpload(); selectTabByIndex(1);