Skip to content

Commit

Permalink
Crosslinks: support Old Danish
Browse files Browse the repository at this point in the history
Crossink stuf
  • Loading branch information
stscoundrel committed Feb 24, 2024
1 parent de7f0fb commit 91c1d34
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/Crosslinks/Crosslinks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ describe('Crosslinks component', () => {
url: 'https://old-norwegian-dictionary.vercel.app/word/fadir',
source: DictionarySource.OldNorwegian,
},
{
url: 'https://old-danish-dictionary.vercel.app/word/fader',
source: DictionarySource.OldDanish,
},
]

test('Matches the snapshot', () => {
Expand All @@ -31,7 +35,7 @@ describe('Crosslinks component', () => {
const tree = renderer.create(<Crosslinks crosslinks={crosslinks} />)
const { root } = tree

expect(root.findAllByProps({ className: styles.listItem }).length).toEqual(3)
expect(root.findAllByProps({ className: styles.listItem }).length).toEqual(4)
})

test('Has expected crosslink content', () => {
Expand All @@ -40,5 +44,6 @@ describe('Crosslinks component', () => {
expect(JSON.stringify(tree)).toContain('Old Swedish - K.F Söderwall\'s Dictionary')
expect(JSON.stringify(tree)).toContain('Old Norwegian - Johan Fritzner\'s Dictionary')
expect(JSON.stringify(tree)).toContain('Old Icelandic - Geir Zoëga\'s Dictionary')
expect(JSON.stringify(tree)).toContain('Old Danish - Otto Kalkar\'s Dictionary')
})
})
11 changes: 11 additions & 0 deletions src/components/Crosslinks/__snapshots__/Crosslinks.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ exports[`Crosslinks component Matches the snapshot 1`] = `
Old Norwegian - Johan Fritzner's Dictionary
</a>
</li>
<li
className="listItem"
>
<a
href="https://old-danish-dictionary.vercel.app/word/fader"
rel="noopener noreferrer"
target="_blank"
>
Old Danish - Otto Kalkar's Dictionary
</a>
</li>
</ul>,
]
`;
4 changes: 4 additions & 0 deletions src/components/Crosslinks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export default function Crosslinks({ crosslinks }: CrossLinkProps) {
return 'Old Icelandic - Geir Zoëga\'s Dictionary'
}

if (source === 'old-danish') {
return 'Old Danish - Otto Kalkar\'s Dictionary'
}

return ''
}

Expand Down

0 comments on commit 91c1d34

Please sign in to comment.