mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
✅ add first page condition when search submit
This commit is contained in:
@@ -28,6 +28,7 @@ describe('SearchFormComponent', () => {
|
|||||||
const searchService = new SearchServiceStub();
|
const searchService = new SearchServiceStub();
|
||||||
const paginationService = new PaginationServiceStub();
|
const paginationService = new PaginationServiceStub();
|
||||||
const searchConfigService = { paginationID: 'test-id' };
|
const searchConfigService = { paginationID: 'test-id' };
|
||||||
|
const firstPage = { 'spc.page': 1 };
|
||||||
const dspaceObjectService = {
|
const dspaceObjectService = {
|
||||||
findById: () => createSuccessfulRemoteDataObject$(undefined),
|
findById: () => createSuccessfulRemoteDataObject$(undefined),
|
||||||
};
|
};
|
||||||
@@ -104,16 +105,16 @@ describe('SearchFormComponent', () => {
|
|||||||
const scope = 'MCU';
|
const scope = 'MCU';
|
||||||
let searchQuery = {};
|
let searchQuery = {};
|
||||||
|
|
||||||
it('should navigate to the search page even when no parameters are provided', () => {
|
it('should navigate to the search first page even when no parameters are provided', () => {
|
||||||
comp.updateSearch(searchQuery);
|
comp.updateSearch(searchQuery);
|
||||||
|
|
||||||
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
||||||
queryParams: searchQuery,
|
queryParams: { ...searchQuery, ...firstPage },
|
||||||
queryParamsHandling: 'merge'
|
queryParamsHandling: 'merge'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to the search page with parameters only query if only query is provided', () => {
|
it('should navigate to the search first page with parameters only query if only query is provided', () => {
|
||||||
searchQuery = {
|
searchQuery = {
|
||||||
query: query
|
query: query
|
||||||
};
|
};
|
||||||
@@ -121,12 +122,12 @@ describe('SearchFormComponent', () => {
|
|||||||
comp.updateSearch(searchQuery);
|
comp.updateSearch(searchQuery);
|
||||||
|
|
||||||
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
||||||
queryParams: searchQuery,
|
queryParams: { ...searchQuery, ...firstPage },
|
||||||
queryParamsHandling: 'merge'
|
queryParamsHandling: 'merge'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to the search page with parameters only query if only scope is provided', () => {
|
it('should navigate to the search first page with parameters only query if only scope is provided', () => {
|
||||||
searchQuery = {
|
searchQuery = {
|
||||||
scope: scope
|
scope: scope
|
||||||
};
|
};
|
||||||
@@ -134,7 +135,7 @@ describe('SearchFormComponent', () => {
|
|||||||
comp.updateSearch(searchQuery);
|
comp.updateSearch(searchQuery);
|
||||||
|
|
||||||
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
||||||
queryParams: searchQuery,
|
queryParams: {...searchQuery, ...firstPage},
|
||||||
queryParamsHandling: 'merge'
|
queryParamsHandling: 'merge'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user