-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #863 from europeana/feat/MET-6213-Debias-Consolida…
…tion MET-6213 Debias Consolidation
- Loading branch information
Showing
17 changed files
with
605 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
context('Sandbox', () => { | ||
describe('Debias', () => { | ||
const force = { force: true }; | ||
const selDebiasLink = 'li .debias-link'; | ||
const txtNoDetections = 'No Biases Found'; | ||
const pollInterval = 2000; | ||
|
||
it('should not allow debias checks for failed datasets', () => { | ||
cy.visit('/dataset/909'); | ||
cy.wait(1000); | ||
cy.get(selDebiasLink).should('not.exist'); | ||
}); | ||
|
||
it('should show an empty report', () => { | ||
cy.visit('/dataset/28'); | ||
cy.wait(pollInterval); | ||
cy.get(selDebiasLink) | ||
.last() | ||
.click(force); | ||
cy.wait(1); | ||
cy.get(selDebiasLink) | ||
.last() | ||
.click(force); | ||
cy.contains(txtNoDetections).should('exist'); | ||
}); | ||
|
||
it('should show a report', () => { | ||
cy.visit('/dataset/3'); | ||
cy.wait(pollInterval); | ||
cy.get(selDebiasLink) | ||
.last() | ||
.click(force); | ||
cy.contains(txtNoDetections).should('not.exist'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
projects/sandbox/src/app/_translate/format-dc-field.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FormatDcFieldPipe } from '.'; | ||
import { DebiasSourceField } from '../_models'; | ||
|
||
describe('FormatDcFieldPipe', () => { | ||
it('should transform', () => { | ||
const pipe = new FormatDcFieldPipe(); | ||
expect(pipe.transform('hello')).toEqual('hello'); | ||
expect(pipe.transform(DebiasSourceField.DC_TITLE)).toEqual('dc:title'); | ||
expect(pipe.transform(DebiasSourceField.DC_DESCRIPTION)).toEqual('dc:description'); | ||
expect(pipe.transform(DebiasSourceField.DC_TYPE_LITERAL)).toEqual('dc:type literal'); | ||
expect(pipe.transform(DebiasSourceField.DC_TYPE_REFERENCE)).toEqual('dc:type reference'); | ||
expect(pipe.transform(DebiasSourceField.DC_SUBJECT_LITERAL)).toEqual('dc:subject literal'); | ||
expect(pipe.transform(DebiasSourceField.DC_SUBJECT_REFERENCE)).toEqual('dc:subject reference'); | ||
expect(pipe.transform(DebiasSourceField.DCTERMS_ALTERNATIVE)).toEqual('dc:terms alternative'); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
projects/sandbox/src/app/_translate/format-language.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { FormatLanguagePipe } from '.'; | ||
|
||
describe('FormatLanguagePipe', () => { | ||
it('should transform', () => { | ||
const pipe = new FormatLanguagePipe(); | ||
expect(pipe.transform('en')).toEqual('English'); | ||
expect(pipe.transform('de')).toEqual('German'); | ||
expect(pipe.transform('xxx')).toEqual('xxx'); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
projects/sandbox/src/app/_translate/format-language.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { isoLanguageNames } from '../_data'; | ||
|
||
@Pipe({ | ||
name: 'formatLanguage', | ||
standalone: true | ||
}) | ||
export class FormatLanguagePipe implements PipeTransform { | ||
transform(value: string): string { | ||
const translated = isoLanguageNames[value]; | ||
return translated || value; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
projects/sandbox/src/app/_translate/highlight-matches-and-link.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { HighlightMatchesAndLinkPipe } from './'; | ||
import { DebiasTag } from '../_models'; | ||
|
||
describe('highlight matches and link pipe', () => { | ||
let pipe: HighlightMatchesAndLinkPipe; | ||
|
||
const getTagOpen = (href: string): string => { | ||
return `<a href="${href}" class="term-highlight external-link-debias" target="_blank">`; | ||
}; | ||
|
||
beforeEach(() => { | ||
pipe = new HighlightMatchesAndLinkPipe(); | ||
}); | ||
|
||
it('should not alter the string if no args are supplied', () => { | ||
expect(pipe.transform('hello')).toBe('hello'); | ||
}); | ||
|
||
it('should not alter the string if empty args are supplied', () => { | ||
expect(pipe.transform('hello', [])).toBe('hello'); | ||
expect(pipe.transform('hello', [[]])).toBe('hello'); | ||
}); | ||
|
||
it('should highlight', () => { | ||
const href = 'http://www.the-link.com'; | ||
|
||
const dts: Array<DebiasTag> = [ | ||
{ | ||
start: 1, | ||
end: 2, | ||
length: 1, | ||
uri: href | ||
} | ||
]; | ||
|
||
expect(pipe.transform('hello', [dts])).toBe('h' + getTagOpen(href) + 'e</a>llo'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.