mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
90768: Already selected filters were still displayed in the clickable suggestions
This commit is contained in:
@@ -162,7 +162,7 @@ describe('SearchFacetSelectedOptionComponent', () => {
|
||||
comp.removeQueryParams = {};
|
||||
(comp as any).updateRemoveParams(selectedValues);
|
||||
expect(comp.removeQueryParams).toEqual({
|
||||
[mockFilterConfig.paramName]: [value1],
|
||||
[mockFilterConfig.paramName]: [`${value1},equals`],
|
||||
['page-id.page']: 1
|
||||
});
|
||||
});
|
||||
|
@@ -37,7 +37,7 @@ describe('Search Utils', () => {
|
||||
});
|
||||
|
||||
it('should retrieve the correct value from the search href', () => {
|
||||
expect(getFacetValueForType(facetValueWithSearchHref, searchFilterConfig)).toEqual('Value with search href,operator');
|
||||
expect(getFacetValueForType(facetValueWithSearchHref, searchFilterConfig)).toEqual('Value with search href,equals');
|
||||
});
|
||||
|
||||
it('should retrieve the correct value from the Facet', () => {
|
||||
|
@@ -9,11 +9,11 @@ import { isNotEmpty } from '../empty.util';
|
||||
* @param searchFilterConfig
|
||||
*/
|
||||
export function getFacetValueForType(facetValue: FacetValue, searchFilterConfig: SearchFilterConfig): string {
|
||||
const regex = new RegExp(`[?|&]${escapeRegExp(searchFilterConfig.paramName)}=(${escapeRegExp(facetValue.value)}[^&]*)`, 'g');
|
||||
const regex = new RegExp(`[?|&]${escapeRegExp(encodeURIComponent(searchFilterConfig.paramName))}=(${escapeRegExp(encodeURIComponent(facetValue.value))}[^&]*)`, 'g');
|
||||
if (isNotEmpty(facetValue._links)) {
|
||||
const values = regex.exec(facetValue._links.search.href);
|
||||
if (isNotEmpty(values)) {
|
||||
return values[1];
|
||||
return decodeURIComponent(values[1]);
|
||||
}
|
||||
}
|
||||
if (facetValue.authorityKey) {
|
||||
|
Reference in New Issue
Block a user