[ACA-1455] universal Viewer @effect (#412)

* viewer @effect

* universal preview effect

* remove router where not needed

* update tests

* update tests
This commit is contained in:
Denys Vuika
2018-06-14 14:10:31 +01:00
committed by Cilibiu Bogdan
parent d1e5353d7a
commit f8fe664f1f
22 changed files with 123 additions and 194 deletions

View File

@@ -25,7 +25,6 @@
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientModule } from '@angular/common/http';
import {
@@ -51,7 +50,6 @@ import { INITIAL_STATE } from '../../store/states/app.state';
describe('RecentFiles Routed Component', () => {
let fixture: ComponentFixture<RecentFilesComponent>;
let component: RecentFilesComponent;
let router: Router;
let alfrescoApi: AlfrescoApiService;
let contentService: ContentManagementService;
let page;
@@ -108,7 +106,6 @@ describe('RecentFiles Routed Component', () => {
fixture = TestBed.createComponent(RecentFilesComponent);
component = fixture.componentInstance;
router = TestBed.get(Router);
contentService = TestBed.get(ContentManagementService);
alfrescoApi = TestBed.get(AlfrescoApiService);
alfrescoApi.reset();
@@ -153,28 +150,6 @@ describe('RecentFiles Routed Component', () => {
});
});
describe('onNodeDoubleClick()', () => {
it('open preview if node is file', () => {
spyOn(router, 'navigate').and.stub();
const node: any = { id: 'node-id', isFile: true };
component.onNodeDoubleClick(node);
fixture.detectChanges();
expect(router.navigate['calls'].argsFor(0)[0]).toEqual(['./preview', node.id]);
});
it('does not open preview if node is folder', () => {
spyOn(router, 'navigate').and.stub();
const node: any = { isFolder: true };
component.onNodeDoubleClick(node);
fixture.detectChanges();
expect(router.navigate).not.toHaveBeenCalled();
});
});
describe('refresh', () => {
it('should call document list reload', () => {
spyOn(component.documentList, 'reload');