Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize value for search label translation #13

Open
wants to merge 6 commits into
base: dspace-cris-2023_02_x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<a class="badge badge-primary mr-1 mb-1" [routerLink]="searchLink" [queryParams]="(removeParameters | async)"
queryParamsHandling="merge">
{{('search.filters.applied.' + key) | translate}}: {{'search.filters.' + filterName + '.' + value | translate: {default:
normalizeFilterValue(getStrippedValue(value))} }}
{{('search.filters.applied.' + key) | translate}}: {{'search.filters.' + filterName + '.' + normalizeFilterValue(value) | translate: {default:
normalizeFilterValue(value)} }}
<span> ×</span>
</a>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe('SearchLabelComponent', () => {
const normValue1 = 'Test, Author';
const value2 = 'TestSubject';
const value3 = 'Test, Authority,authority';
const value4 = 'book,equals';
const normValue3 = 'Test, Authority';
const normValue4 = 'book';
const filter1 = [key1, value1];
const filter2 = [key2, value2];
const mockFilters = [
Expand Down Expand Up @@ -92,6 +94,9 @@ describe('SearchLabelComponent', () => {

result = comp.normalizeFilterValue(value3);
expect(result).toBe(normValue3);

result = comp.normalizeFilterValue(value4);
expect(result).toBe(normValue4);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ export class SearchLabelComponent implements OnInit {
*/
normalizeFilterValue(value: string) {
// const pattern = /,[^,]*$/g;
const pattern = /,authority*$/g;
value = value.replace(pattern, '');
return stripOperatorFromFilterValue(value);
}

Expand Down