hide close button viewer in not overlay mode

This commit is contained in:
Eugenio Romano 2016-08-02 10:25:18 +01:00
parent 393b66602a
commit 2e8644b4bc
2 changed files with 20 additions and 2 deletions

View File

@ -20,7 +20,7 @@
<!-- Start Navigation -->
<nav class="mdl-navigation">
<div id="viewer-toolbar-view-options">
<button
<button *ngIf="overlayMode"
class="mdl-color--black mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored" (click)="close()">
<i id="viewer-close-button" class="icon material-icons">close</i>
</button>

View File

@ -70,13 +70,14 @@ import { EventMock } from './assets/event.mock';
});
}));
it('Close button should be present', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
it('Close button should be present if 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();
@ -84,6 +85,22 @@ import { EventMock } from './assets/event.mock';
});
}));
it('Close button should be not 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('#viewer-close-button')).toBeNull();
});
}));
it('Click on close button should hide the viewer', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(ViewerComponent)
@ -91,6 +108,7 @@ import { EventMock } from './assets/event.mock';
let element = fixture.nativeElement;
let component = fixture.componentInstance;
component.urlFile = 'fake-url-file';
component.overlayMode = true;
fixture.detectChanges();
element.querySelector('#viewer-close-button').click();