[ACA-2850][ACA-2849] Viewer - document properties not refreshed after changes or uploading new version (#1286)

* update viewer on upload complete

* prevent multiple same actions triggers

* Display node again after upload was complete

* Add e2e test for showing 'Editing Offline' when a new version was uploaded and the node was locked before

* Add e2e test for showing 'Editing Offline' when a new version was uploaded and the node was locked before

* Add e2e test for showing 'Editing Offline' when a new version was uploaded and the node was locked before

* Update src/app/components/page.component.ts

return type

Co-Authored-By: Denys Vuika <denys.vuika@alfresco.com>

* return type

Co-Authored-By: Denys Vuika <denys.vuika@alfresco.com>

* return type

Co-Authored-By: Denys Vuika <denys.vuika@alfresco.com>

Co-authored-by: Martin Muller <damadden88@googlemail.com>
Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
Cilibiu Bogdan
2020-01-02 20:17:59 +02:00
committed by GitHub
parent 0d0ddfcf37
commit 55547ed163
5 changed files with 89 additions and 4 deletions

View File

@@ -24,20 +24,29 @@
*/
import { PageComponent } from './page.component';
import {
ReloadDocumentListAction,
SetSelectedNodesAction
} from '@alfresco/aca-shared/store';
import { MinimalNodeEntity } from '@alfresco/js-api';
class TestClass extends PageComponent {
node: any;
constructor() {
super(null, null, null);
constructor(store) {
super(store, null, null);
}
}
describe('PageComponent', () => {
let component: TestClass;
const store = {
dispatch: jasmine.createSpy('dispatch'),
select: jasmine.createSpy('select')
};
beforeEach(() => {
component = new TestClass();
component = new TestClass(store);
});
describe('getParentNodeId()', () => {
@@ -53,4 +62,38 @@ describe('PageComponent', () => {
expect(component.getParentNodeId()).toBe(null);
});
});
describe('Reload', () => {
const locationHref = location.href;
afterEach(() => {
window.history.pushState({}, null, locationHref);
});
it('should not reload if url contains viewer outlet', () => {
window.history.pushState({}, null, `${locationHref}#test(viewer:view)`);
component.reload();
expect(store.dispatch).not.toHaveBeenCalled();
});
it('should reload if url does not contain viewer outlet', () => {
component.reload();
expect(store.dispatch).toHaveBeenCalledWith(
new ReloadDocumentListAction()
);
});
it('should set selection after reload if node is passed', () => {
const node = {
entry: {
id: 'node-id'
}
} as MinimalNodeEntity;
component.reload(node);
expect(store.dispatch['calls'].mostRecent().args[0]).toEqual(
new SetSelectedNodesAction([node])
);
});
});
});