created elementCount component and test

This commit is contained in:
Arman
2022-04-19 10:24:33 +02:00
parent 2727ff704d
commit cbdba8ad19
3 changed files with 16 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
<script lang="ts">
export let count: number = 0;
</script>
<p>{count} <slot /> found</p>
+1
View File
@@ -16,3 +16,4 @@ export { default as Collapsible } from './collapsible.svelte';
export { default as Avatar } from './avatar.svelte';
export { default as SwitchBox } from './switchBox.svelte';
export { default as SwitchBoxes } from './switchBoxes.svelte';
export { default as ElementCount } from './elementCount.svelte';
@@ -0,0 +1,10 @@
import '@testing-library/jest-dom';
import { render } from '@testing-library/svelte';
import { ElementCount } from '../../../src/lib/components';
test('shows correct count', () => {
const { getByText } = render(ElementCount, {
count: 1
});
expect(getByText(/1/i)).toBeInTheDocument();
});