mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-19 17:14:45 +00:00
[ACA-2081] Search - toolbar not visible after viewer is closed (#869)
* router event filter search * test * added comment
This commit is contained in:
parent
8843c9ec46
commit
5a1257c9ff
@ -41,7 +41,7 @@ class MockRouter {
|
|||||||
events = this.subject.asObservable();
|
events = this.subject.asObservable();
|
||||||
routerState = { snapshot: { url: this.url } };
|
routerState = { snapshot: { url: this.url } };
|
||||||
|
|
||||||
navigate(url: string) {
|
navigateByUrl(url: string) {
|
||||||
const navigationStart = new NavigationStart(0, url);
|
const navigationStart = new NavigationStart(0, url);
|
||||||
this.subject.next(navigationStart);
|
this.subject.next(navigationStart);
|
||||||
}
|
}
|
||||||
@ -143,11 +143,24 @@ describe('AppLayoutComponent', () => {
|
|||||||
const selection = [{ entry: { id: 'nodeId', name: 'name' } }];
|
const selection = [{ entry: { id: 'nodeId', name: 'name' } }];
|
||||||
store.dispatch(new SetSelectedNodesAction(selection));
|
store.dispatch(new SetSelectedNodesAction(selection));
|
||||||
|
|
||||||
router.navigate(['somewhere/over/the/rainbow']);
|
router.navigateByUrl('somewhere/over/the/rainbow');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
store.select(appSelection).subscribe(state => {
|
store.select(appSelection).subscribe(state => {
|
||||||
expect(state.isEmpty).toBe(true);
|
expect(state.isEmpty).toBe(true);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not reset selection if route is `/search`', done => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
const selection = [{ entry: { id: 'nodeId', name: 'name' } }];
|
||||||
|
store.dispatch(new SetSelectedNodesAction(selection));
|
||||||
|
|
||||||
|
router.navigateByUrl('/search;q=');
|
||||||
|
fixture.detectChanges();
|
||||||
|
store.select(appSelection).subscribe(state => {
|
||||||
|
expect(state.isEmpty).toBe(false);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -135,7 +135,13 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.router.events
|
this.router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(event => event instanceof NavigationStart),
|
filter(event => {
|
||||||
|
return (
|
||||||
|
event instanceof NavigationStart &&
|
||||||
|
// search employs reuse route strategy
|
||||||
|
!event.url.startsWith('/search;')
|
||||||
|
);
|
||||||
|
}),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntil(this.onDestroy$)
|
||||||
)
|
)
|
||||||
.subscribe(() => this.store.dispatch(new SetSelectedNodesAction([])));
|
.subscribe(() => this.store.dispatch(new SetSelectedNodesAction([])));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user