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:
parent
f6c8343751
commit
fd2ab00cb9
3 changed files with 44 additions and 3 deletions
3
src/lib/components/atoms/BlockOrReport.svelte
Normal file
3
src/lib/components/atoms/BlockOrReport.svelte
Normal file
|
@ -0,0 +1,3 @@
|
|||
<button type="button" class="underline">block</button>
|
||||
or
|
||||
<button type="button" class="underline">report</button>
|
|
@ -1,5 +1,6 @@
|
|||
<script>
|
||||
import Avatar from '$lib/components/atoms/Avatar.svelte';
|
||||
import BlockOrReport from '$lib/components/atoms/BlockOrReport.svelte';
|
||||
import Created from '$lib/components/atoms/Created.svelte';
|
||||
|
||||
/** @type {import('./$types').PageData} */
|
||||
|
@ -18,9 +19,7 @@
|
|||
created_at={data.user.created_at}
|
||||
created_at_formatted={data.user.created_at_formatted}
|
||||
/>
|
||||
<button type="button" class="underline">block</button>
|
||||
or
|
||||
<button type="button" class="underline">report</button>
|
||||
<BlockOrReport />
|
||||
</div>
|
||||
<!-- Top Row -->
|
||||
<div class="flex mt-2">
|
||||
|
|
39
tests/components/atoms/BlockOrReport.test.ts
Normal file
39
tests/components/atoms/BlockOrReport.test.ts
Normal 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();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue