Svelte API
Methods​
mount​
import { mount } from 'cypress/svelte'
Description | Mounts a Svelte component inside the Cypress browser |
Signature | mount<T extends SvelteComponent>(Component: SvelteConstructor<T>, options?: MountOptions<T>): Cypress.Chainable<MountReturn<T>> |
Generic Param T | The component type |
Returns | Cypress.Chainable<MountReturn> |
Name | Type | Description |
component | SvelteConstructor<T> | Svelte component being mounted |
options | MountOptions<T> (optional) | options to customize the component being mounted |
Example​
import Counter from './Counter.svelte'
import { mount } from 'cypress/svelte'
it('should render', () => {
mount(Counter, { props: { count: 42 } })
cy.get('button').contains(42)
})
Interfaces​
MountOptions​
Name | Type | Description |
anchor | Element (optional) | |
context | Map<any, any> (optional) | |
intro | boolean (optional) | |
log | boolean (optional) | |
props | Record<string any> (optional) |
MountReturn​
Type that the mount
function yields
Name | Type | Description |
component | T |