[ADF-2352] project toolbar buttons for the Viewer (#2989)

* project toolbar buttons for the Viewer

* test fixes
This commit is contained in:
Denys Vuika
2018-02-23 15:48:17 +00:00
committed by Eugenio Romano
parent 1c48a3c0df
commit f7cfccc7d9
8 changed files with 101 additions and 4 deletions

View File

@@ -38,6 +38,7 @@ import { ViewerMoreActionsComponent } from './viewer-more-actions.component';
import { ViewerOpenWithComponent } from './viewer-open-with.component';
import { ViewerSidebarComponent } from './viewer-sidebar.component';
import { ViewerToolbarComponent } from './viewer-toolbar.component';
import { ViewerToolbarActionsComponent } from './viewer-toolbar-actions.component';
import { ViewerComponent } from './viewer.component';
import { FlexLayoutModule } from '@angular/flex-layout';
import 'rxjs/add/observable/throw';
@@ -54,6 +55,20 @@ import 'rxjs/add/observable/throw';
})
class ViewerWithCustomToolbarComponent {}
@Component({
selector: 'adf-viewer-container-toolbar-actions',
template: `
<adf-viewer>
<adf-viewer-toolbar-actions>
<button mat-icon-button id="custom-button">
<mat-icon>alarm</mat-icon>
</button>
</adf-viewer-toolbar-actions>
</adf-viewer>
`
})
class ViewerWithCustomToolbarActionsComponent {}
@Component({
selector: 'adf-viewer-container-sidebar',
template: `
@@ -141,10 +156,12 @@ describe('ViewerComponent', () => {
ViewerToolbarComponent,
ViewerOpenWithComponent,
ViewerMoreActionsComponent,
ViewerToolbarActionsComponent,
ViewerWithCustomToolbarComponent,
ViewerWithCustomSidebarComponent,
ViewerWithCustomOpenWithComponent,
ViewerWithCustomMoreActionsComponent
ViewerWithCustomMoreActionsComponent,
ViewerWithCustomToolbarActionsComponent
],
providers: [
{provide: RenditionsService, useValue: {
@@ -203,6 +220,14 @@ describe('ViewerComponent', () => {
expect(customElement.querySelector('.custom-toolbar-element')).toBeDefined();
});
it('should use custom toolbar actions', () => {
let customFixture = TestBed.createComponent(ViewerWithCustomToolbarActionsComponent);
let customElement: HTMLElement = customFixture.nativeElement;
customFixture.detectChanges();
expect(customElement.querySelector('#custom-button')).toBeDefined();
});
it('should use custom info drawer', () => {
let customFixture = TestBed.createComponent(ViewerWithCustomSidebarComponent);
let customElement: HTMLElement = customFixture.nativeElement;