From f064cb0beafeb6b92af9a9769a309d9ca399779d Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Tue, 2 Aug 2016 15:08:53 +0100 Subject: [PATCH] hide header in not overlay mode --- .../src/viewer.component.html | 4 +- .../src/viewer.component.spec.ts | 38 +++++++++++++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/ng2-components/ng2-alfresco-viewer/src/viewer.component.html b/ng2-components/ng2-alfresco-viewer/src/viewer.component.html index 485406c28d..7146bb54f3 100644 --- a/ng2-components/ng2-alfresco-viewer/src/viewer.component.html +++ b/ng2-components/ng2-alfresco-viewer/src/viewer.component.html @@ -6,8 +6,8 @@
-
-
+
+
diff --git a/ng2-components/ng2-alfresco-viewer/src/viewer.component.spec.ts b/ng2-components/ng2-alfresco-viewer/src/viewer.component.spec.ts index 4a4795074d..12157298c3 100644 --- a/ng2-components/ng2-alfresco-viewer/src/viewer.component.spec.ts +++ b/ng2-components/ng2-alfresco-viewer/src/viewer.component.spec.ts @@ -23,7 +23,7 @@ import { EventMock } from './assets/event.mock'; describe('ViewerComponent', () => { describe('View', () => { - it('shadow overlay should be present if overlay is true', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { + it('shadow overlay should be present if is overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { return tcb .createAsync(ViewerComponent) .then((fixture) => { @@ -38,13 +38,45 @@ import { EventMock } from './assets/event.mock'; }); })); - it('Name File should be present', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { + it('header should be present if is overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { + return tcb + .createAsync(ViewerComponent) + .then((fixture) => { + let element = fixture.nativeElement; + let component = fixture.componentInstance; + component.urlFile = 'fake-url-file'; + component.overlayMode = true; + + fixture.detectChanges(); + + expect(element.querySelector('header')).not.toBeNull(); + }); + })); + + + it('header should be NOT be present if is not overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { + return tcb + .createAsync(ViewerComponent) + .then((fixture) => { + let element = fixture.nativeElement; + let component = fixture.componentInstance; + component.urlFile = 'fake-url-file'; + component.overlayMode = false; + + fixture.detectChanges(); + + expect(element.querySelector('header')).toBeNull(); + }); + })); + + it('Name File should be present if is overlay mode ', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { return tcb .createAsync(ViewerComponent) .then((fixture) => { let element = fixture.nativeElement; let component = fixture.componentInstance; component.urlFile = 'http://localhost:9876/fake-url-file.pdf'; + component.overlayMode = true; component.ngOnChanges().then(() => { fixture.detectChanges(); @@ -117,7 +149,7 @@ import { EventMock } from './assets/event.mock'; }); })); - it('Esc button should not hide the viewer if is not overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { + it('Esc button should not hide the viewerls if is not overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { return tcb .createAsync(ViewerComponent) .then((fixture) => {