File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ export async function renderToCanvas(
8080 target : canvasElement ,
8181 props,
8282 } ) ;
83- await svelte . tick ( ) ;
8483 componentsByDomElement . set ( canvasElement , { mountedComponent, props } ) ;
84+ await svelte . tick ( ) ;
8585 } else {
8686 // We need to mutate the existing props for Svelte reactivity to work, we can't just re-assign them
8787 Object . assign ( existingComponent . props , {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import type { StoryObj } from '@storybook/svelte';
22
33import { expect , fn , waitFor } from 'storybook/test' ;
44
5- // import * as svelte from 'svelte';
65import AsyncComponent from './AsyncComponent.svelte' ;
76import SyncComponent from './SyncComponent.svelte' ;
87
@@ -41,9 +40,12 @@ export const Async: StoryObj<typeof AsyncComponent> = {
4140 // TODO: Ideally we should be able to call await svelte.settled() here instead of waitFor, but currently there's a bug making it never resolve
4241 // await svelte.settled();
4342
44- await waitFor ( ( ) => {
45- expect ( args . onEffect ) . toHaveBeenCalledOnce ( ) ;
46- expect ( canvas . getByTestId ( 'after-effect' ) ) . toBeInTheDocument ( ) ;
43+ await waitFor ( async ( ) => {
44+ await expect ( args . onEffect ) . toHaveBeenCalledOnce ( ) ;
45+ await expect ( canvas . getByTestId ( 'after-effect' ) ) . toBeInTheDocument ( ) ;
46+ await expect (
47+ canvasElement . querySelector ( '#sb-pending-async-component-notice' )
48+ ) . not . toBeInTheDocument ( ) ;
4749 } ) ;
4850 } ,
4951} ;
You can’t perform that action at this time.
0 commit comments