mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1841] Hide app menu in preview (#698)
* hide menu in preview * fix getNodeInfo return value when no node is found
This commit is contained in:
committed by
Denys Vuika
parent
94b1420e6e
commit
253425971f
@@ -16,7 +16,10 @@
|
||||
|
||||
<adf-sidenav-layout-header>
|
||||
<ng-template>
|
||||
<app-header (toggleClicked)="layout.toggleMenu($event)"></app-header>
|
||||
<app-header
|
||||
*ngIf="!sidenavManager.hideSidenav"
|
||||
(toggleClicked)="layout.toggleMenu($event)">
|
||||
</app-header>
|
||||
</ng-template>
|
||||
</adf-sidenav-layout-header>
|
||||
|
||||
|
@@ -24,9 +24,57 @@
|
||||
*/
|
||||
|
||||
import { SidenavViewsManagerDirective } from './sidenav-views-manager.directive';
|
||||
import { NavigationEnd } from '@angular/router';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
class RouterMock {
|
||||
private subject = new Subject();
|
||||
public events = this.subject.asObservable();
|
||||
|
||||
navigate(url = '') {
|
||||
const navigationEnd = new NavigationEnd(0, '', url);
|
||||
this.subject.next(navigationEnd);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.subject.next(null);
|
||||
this.subject.complete();
|
||||
this.subject = null;
|
||||
}
|
||||
}
|
||||
|
||||
describe('SidenavViewsManagerDirective', () => {
|
||||
it('should be defined', () => {
|
||||
expect(SidenavViewsManagerDirective).toBeDefined();
|
||||
let component;
|
||||
let router;
|
||||
|
||||
beforeEach(() => {
|
||||
router = <any>new RouterMock();
|
||||
component = new SidenavViewsManagerDirective(router, null, null);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
router.destroy();
|
||||
});
|
||||
|
||||
describe('Router events', () => {
|
||||
it('should set minimizeSidenav to true when url is in minimizeConditions', () => {
|
||||
router.navigate('/search/');
|
||||
expect(component.minimizeSidenav).toBe(true);
|
||||
});
|
||||
|
||||
it('should set minimizeSidenav to false when url is not in minimizeConditions', () => {
|
||||
router.navigate('/somewhere/');
|
||||
expect(component.minimizeSidenav).toBe(false);
|
||||
});
|
||||
|
||||
it('should set hideSidenav property to true when url is in hideConditions', () => {
|
||||
router.navigate('/preview/');
|
||||
expect(component.hideSidenav).toBe(true);
|
||||
});
|
||||
|
||||
it('should set hideSidenav property to false when url is not in hideConditions', () => {
|
||||
router.navigate('somewhere');
|
||||
expect(component.hideSidenav).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -358,7 +358,7 @@ describe('PreviewComponent', () => {
|
||||
|
||||
it('should navigate to original location if node not found', async () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
spyOn(contentApi, 'getNodeInfo').and.returnValue(of(null));
|
||||
spyOn(contentApi, 'getNodeInfo').and.returnValue(Promise.reject('error'));
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
await component.displayNode('folder1');
|
||||
|
Reference in New Issue
Block a user