From: Ruben Beltran del Rio Date: Thu, 22 Apr 2021 21:02:02 +0000 (+0200) Subject: Add tests for header X-Git-Url: https://git.r.bdr.sh/rbdr/forum/commitdiff_plain/55fb920baa9792266be1a6b981f954c622c1eaf9 Add tests for header Also patches up the leaky abstraction on the actions --- diff --git a/src/components/actions/topic.svelte b/src/components/actions/topic.svelte new file mode 100644 index 0000000..e2f59c9 --- /dev/null +++ b/src/components/actions/topic.svelte @@ -0,0 +1,24 @@ + + +
  • + + {@html $_('header.action.reply.display')} + +
  • + + diff --git a/src/components/actions/topic.test.js b/src/components/actions/topic.test.js new file mode 100644 index 0000000..9d6ee93 --- /dev/null +++ b/src/components/actions/topic.test.js @@ -0,0 +1,25 @@ +import '@testing-library/jest-dom/extend-expect'; + +import { render } from '@testing-library/svelte'; +import '$/config/i18n'; + +import Topic from './topic.svelte'; + +const internals = { + results: null +}; + +describe('Topic Actions component', () => { + + test('Should link to reply page', () => { + + const results = render(Topic, { props: { + actions: { + id: '8ebaa211-fd9b-423a-8b4f-b57622007fde' + } + } }); + + expect(results.getByTitle('Reply').closest('a')) + .toHaveAttribute('href', '/reply/8ebaa211-fd9b-423a-8b4f-b57622007fde'); + }); +}); diff --git a/src/components/header/header.svelte b/src/components/header/header.svelte index f33e77b..dcf95d5 100644 --- a/src/components/header/header.svelte +++ b/src/components/header/header.svelte @@ -1,39 +1,34 @@