Skip to content

Commit

Permalink
MET-4371 Fix broken portal URLs (regression)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjmaclean committed Mar 25, 2022
1 parent 853e630 commit f648483
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/app/overview/overview.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,24 @@ describe('OverviewComponent', () => {
component.ngOnDestroy();
}));

it('should calculate the portal urls', () => {
const rootUrl =
'https://www.europeana.eu/search?query=*&qf=contentTier:(1%20OR%202%20OR%203%20OR%204)';
const data = [{ name: 'name', value: 1, percent: 1, rawName: 'rawName' }];

component.form.value.facetParameter = DimensionName.rights;
fixture.detectChanges();

const res1 = component.portalUrlsFromNVPs(DimensionName.rights, data);
expect(res1.name).toEqual(`${rootUrl}&qf=RIGHTS:\"rawName\"`);

component.form.value.facetParameter = DimensionName.type;
fixture.detectChanges();

const res2 = component.portalUrlsFromNVPs(DimensionName.type, data);
expect(res2.name).toEqual(`${rootUrl}&qf=TYPE:\"name\"`);
});

it('should show the date disclaimer', () => {
spyOn(dialog, 'open');
component.showDateDisclaimer();
Expand Down
5 changes: 3 additions & 2 deletions src/app/overview/overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,9 @@ export class OverviewComponent extends SubscriptionManager implements OnInit {
): IHash<string> {
const result = src.reduce(
(newMap: IHash<string>, nvp: NamesValuePercent) => {
const x = this.getUrlRow(facet, nvp.name);
newMap[nvp.name] = x;
const name = facet === DimensionName.rights ? nvp.rawName : nvp.name;
const url = this.getUrlRow(facet, name);
newMap[nvp.name] = url;
return newMap;
},
{}
Expand Down

0 comments on commit f648483

Please sign in to comment.