refactor: extract block or report buttons to atom

These have no handlers bound to them yet. At that point the atom might
be refactored to a molecule. Let's see.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
André Jaenisch 2024-02-11 18:29:53 +01:00
parent f6c8343751
commit fd2ab00cb9
No known key found for this signature in database
GPG key ID: 5A668E771F1ED854
3 changed files with 44 additions and 3 deletions

View file

@ -0,0 +1,3 @@
<button type="button" class="underline">block</button>
or
<button type="button" class="underline">report</button>

View file

@ -1,5 +1,6 @@
<script> <script>
import Avatar from '$lib/components/atoms/Avatar.svelte'; import Avatar from '$lib/components/atoms/Avatar.svelte';
import BlockOrReport from '$lib/components/atoms/BlockOrReport.svelte';
import Created from '$lib/components/atoms/Created.svelte'; import Created from '$lib/components/atoms/Created.svelte';
/** @type {import('./$types').PageData} */ /** @type {import('./$types').PageData} */
@ -18,9 +19,7 @@
created_at={data.user.created_at} created_at={data.user.created_at}
created_at_formatted={data.user.created_at_formatted} created_at_formatted={data.user.created_at_formatted}
/> />
<button type="button" class="underline">block</button> <BlockOrReport />
or
<button type="button" class="underline">report</button>
</div> </div>
<!-- Top Row --> <!-- Top Row -->
<div class="flex mt-2"> <div class="flex mt-2">

View file

@ -0,0 +1,39 @@
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/svelte';
import BlockOrReport from '../../../src/lib/components/atoms/BlockOrReport.svelte';
describe('BlockOrReport.svelte', () => {
it('should mount', () => {
// Arrange
// Nothing to prepare
// Act
const { container } = render(BlockOrReport);
// Assert
expect(container).toBeTruthy();
});
it('should allow for block', () => {
// Arrange
// Nothing to prepare
// Act
render(BlockOrReport);
// Assert
expect(screen.getByText('block')).toBeDefined();
});
it('should allow for report', () => {
// Arrange
// Nothing to prepare
// Act
render(BlockOrReport);
// Assert
expect(screen.getByText('report')).toBeDefined();
});
});