Testing components
You can test your componets in some simple steps
Setup a test suite
describe('Home component', () => {
it('should render', () => {
})
})Declare and render your component
import { html, render, Component} from 'vistajs/dom';
describe('Home component', () => {
it('should render', () => {
const hello = Component(`app-home`, () => {
return () => html`Hello World`;
});
render(document.body, hello)
})
})Then, make your assertions
Then, just run your tests
You can go even further by taking a look at DOM Testing Library to learn how to use it for testing your applications besides check out Vitest docs
Last updated