hide header in not overlay mode

This commit is contained in:
Eugenio Romano 2016-08-02 15:08:53 +01:00
parent 99f5744543
commit f064cb0bea
2 changed files with 37 additions and 5 deletions

View File

@ -6,8 +6,8 @@
<div id="viewer-main-container" class="viewer-main-container" [ngClass]="{'viewer-overlay-view': overlayMode }" >
<!-- Start Layout -->
<div mdl class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div mdl class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header *ngIf="overlayMode" class="mdl-layout__header">
<div class="mdl-layout__header-row">
<!-- File Title -->

View File

@ -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) => {