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 paginationService = new PaginationServiceStub();
|
||||
const searchConfigService = { paginationID: 'test-id' };
|
||||
const firstPage = { 'spc.page': 1 };
|
||||
const dspaceObjectService = {
|
||||
findById: () => createSuccessfulRemoteDataObject$(undefined),
|
||||
};
|
||||
@@ -104,16 +105,16 @@ describe('SearchFormComponent', () => {
|
||||
const scope = 'MCU';
|
||||
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);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
||||
queryParams: searchQuery,
|
||||
queryParams: { ...searchQuery, ...firstPage },
|
||||
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 = {
|
||||
query: query
|
||||
};
|
||||
@@ -121,12 +122,12 @@ describe('SearchFormComponent', () => {
|
||||
comp.updateSearch(searchQuery);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
||||
queryParams: searchQuery,
|
||||
queryParams: { ...searchQuery, ...firstPage },
|
||||
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 = {
|
||||
scope: scope
|
||||
};
|
||||
@@ -134,7 +135,7 @@ describe('SearchFormComponent', () => {
|
||||
comp.updateSearch(searchQuery);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), {
|
||||
queryParams: searchQuery,
|
||||
queryParams: {...searchQuery, ...firstPage},
|
||||
queryParamsHandling: 'merge'
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user