11 questions
0
votes
0
answers
69
views
Issue: slots Field in Typings for Svelte Component Testing
I am building a Svelte component library for my project and have run into several issues, particularly when trying to test components with slots. Here's the error I'm facing:
Object literal may only ...
1
vote
0
answers
343
views
$state is not defined when testing Svelte component
I am trying to test a simple Svelte component using Jest and @testing-library/svelte, but I am encountering the following error:
Error
ReferenceError: $state is not defined
3 |
4 | it('...
3
votes
1
answer
321
views
Unit testing code that fires at the end of the intro animation in Svelte
I created a Svelte component that is meant to show quickly and then disappear, merely to communicate that the action took place and how many records were touched by the action.
The component is very ...
0
votes
1
answer
202
views
Astro fails with svelte-testing-library
I'm building a website using Astro and a Svelte integration. For testing I added svelte-testing-library which runs fine when being executed with npm test.
Unfortunately after adding the component ...
3
votes
1
answer
499
views
How can I effectively test SvelteKit components, including monitoring reactive properties and props passed to child components?
I'm struggling to understand how to effectively test SvelteKit components like this one.
I want to test the selectedTaxon property, and one approach is to mock the TaxonLinkButton component. However, ...
2
votes
2
answers
2k
views
How to test Svelte component props with Vitest?
I want to test the props of a Svelte component with Vitest.
Component:
<script>
export let foo
</script>
<div>{foo}</div>
Test:
const { component } = render(MyComponent, { ...
4
votes
1
answer
2k
views
How to test the reaction to a component event in Svelte?
In Svelte, I have a parent component which listens to a component event dispatched by a child component.
I know how to use component.$on to check that the dispatched event does the right thing within ...
0
votes
1
answer
923
views
Difference between fireEvent.dblClick & fireEvent.doubleClick in testing library?
Question about 2 different methods exposed via fireEvent API in the react-testing-library.
fireEvent.dblClick
fireEvent.doubleClick
What's the difference? And is there a recommendation to use one ...
1
vote
1
answer
450
views
Svelte - Not able to fetch data from JSON file during jest unit testing
During unit testing, I am getting undefined error, while executing svelte component with json file.
Restaurant.svelte :
import data from '../Data/restaurants.json';
console.log(data);
let finalData = ...
4
votes
1
answer
1k
views
Svelte testing library won't detect component updates
My component:
<script lang="ts">
import { Button } from 'carbon-components-svelte';
import firebase from 'firebase/app';
import { auth } from '../../firebase-shortcut';
import ...
3
votes
2
answers
2k
views
How to test svelte input reactivity?
I wrote a svelte component App in which you can write a sentence in an input and the sentence will be render in a h1.
App.svelte
<script>
let sentence = "Hello world";
</script>...