(
component: Component
)
| 34 | }; |
| 35 | |
| 36 | const loadApp = <T extends Component>( |
| 37 | component: Component |
| 38 | ): { component: T; app: App; div: HTMLDivElement; destroyFc: () => void } => { |
| 39 | const div = document.createElement("div"); |
| 40 | document.body.appendChild(div); |
| 41 | const app = createApp(component, { |
| 42 | ...data, |
| 43 | async destroyComponent(delay = 1000) { |
| 44 | await sleep(delay); |
| 45 | app.unmount(); |
| 46 | div.remove(); |
| 47 | } |
| 48 | }); |
| 49 | const mountedComponent = app.mount(div); |
| 50 | return { |
| 51 | component: mountedComponent as any, |
| 52 | app: app, |
| 53 | div, |
| 54 | destroyFc: () => { |
| 55 | app.unmount(); |
| 56 | div.remove(); |
| 57 | } |
| 58 | }; |
| 59 | }; |
| 60 | |
| 61 | return { |
| 62 | mount, |
no test coverage detected