mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-8427] Fix search behaviour on closing (#5310)
* [ACS-8427] Fix search behaviour on closing * [ACS-8427] Use navigateBack function name instead of exitSearch * [ACS-8427] Fix function name in unit test description
This commit is contained in:
@@ -50,12 +50,21 @@ describe('SearchNavigationService', () => {
|
|||||||
expect(routerNavigate).not.toHaveBeenCalledWith([service.previousRoute]);
|
expect(routerNavigate).not.toHaveBeenCalledWith([service.previousRoute]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to saved route when exitSearch function is called', () => {
|
it('should navigate to saved route when navigateBack function is called', () => {
|
||||||
const routerNavigate = spyOn(router, 'navigate');
|
const routerNavigateByUrl = spyOn(router, 'navigateByUrl');
|
||||||
service.saveRoute('/personal-files');
|
service.saveRoute('/personal-files');
|
||||||
service.navigateBack();
|
service.navigateBack();
|
||||||
|
|
||||||
expect(routerNavigate).toHaveBeenCalledWith([service.previousRoute]);
|
expect(routerNavigateByUrl).toHaveBeenCalledWith(service.previousRoute);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should navigate to saved route including query params when navigateBack function is called', () => {
|
||||||
|
const routerNavigateByUrl = spyOn(router, 'navigateByUrl');
|
||||||
|
const savedRoute = '/personal-files/details/some-node-id?location=%2Fpersonal-files';
|
||||||
|
service.saveRoute(savedRoute);
|
||||||
|
service.navigateBack();
|
||||||
|
|
||||||
|
expect(routerNavigateByUrl).toHaveBeenCalledWith(savedRoute);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to Search when navigateToSearch function is called', () => {
|
it('should navigate to Search when navigateToSearch function is called', () => {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export class SearchNavigationService {
|
|||||||
|
|
||||||
navigateBack(): void {
|
navigateBack(): void {
|
||||||
if (this.previousRoute) {
|
if (this.previousRoute) {
|
||||||
this.router.navigate([this.previousRoute]);
|
this.router.navigateByUrl(this.previousRoute);
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['/personal-files']);
|
this.router.navigate(['/personal-files']);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user