From dbffaded66ba024825fefd94827fc00bbeda5cff Mon Sep 17 00:00:00 2001 From: Amedeo Lepore Date: Mon, 19 Dec 2022 10:33:58 +0100 Subject: [PATCH] [AAE-10778] Fix unit test: expect for internalFileName value instead of display-name id because the display name logic has been moved to the alfresco-viewer.component --- .../viewer-render.component.spec.ts | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/core/src/lib/viewer/components/viewer-render.component.spec.ts b/lib/core/src/lib/viewer/components/viewer-render.component.spec.ts index 4b8bcba50c..b406b37ca8 100644 --- a/lib/core/src/lib/viewer/components/viewer-render.component.spec.ts +++ b/lib/core/src/lib/viewer/components/viewer-render.component.spec.ts @@ -410,46 +410,34 @@ describe('ViewerComponent', () => { describe('display name property override by urlFile', () => { - it('should displayName override the default name if is present and urlFile is set', (done) => { + it('should fileName override the default name if is present and urlFile is set', () => { component.urlFile = 'fake-test-file.pdf'; component.fileName = 'test name'; fixture.detectChanges(); component.ngOnChanges(); - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('test name'); - done(); - }); + expect(component.internalFileName).toEqual('test name'); }); - it('should use the urlFile name if displayName is NOT set and urlFile is set', (done) => { + it('should use the urlFile name if fileName is NOT set and urlFile is set', () => { component.urlFile = 'fake-test-file.pdf'; - component.fileName = null; + component.fileName = ''; fixture.detectChanges(); component.ngOnChanges(); - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf'); - done(); - }); + expect(component.internalFileName).toEqual('fake-test-file.pdf'); }); }); describe('display name property override by blobFile', () => { - it('should displayName override the name if is present and blobFile is set', (done) => { + it('should fileName override the name if is present and blobFile is set', () => { component.fileName = 'blob file display name'; component.blobFile = new Blob(['This is my blob content'], {type: 'text/plain'}); fixture.detectChanges(); component.ngOnChanges(); - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('blob file display name'); - done(); - }); + expect(component.internalFileName).toEqual('blob file display name'); }); it('should show uknownn name if displayName is NOT set and blobFile is set', (done) => {