} from '@vue/runtime-test'
import { createApp, defineComponent } from 'vue'
import type { RawSlots } from 'packages/runtime-core/src/componentSlots'
+import { resetSuspenseId } from '../../src/components/Suspense'
describe('Suspense', () => {
const deps: Promise<any>[] = []
beforeEach(() => {
deps.length = 0
+ resetSuspenseId()
})
// a simple async factory for testing purposes only.
// incrementing unique id for every pending branch
let suspenseId = 0
+/**
+ * For testing only
+ */
+export const resetSuspenseId = () => (suspenseId = 0)
+
// Suspense exposes a component-like API, and is treated like a component
// in the compiler, but internally it's a special built-in type that hooks
// directly into the renderer.
hiddenContainer,
anchor,
deps: 0,
- pendingId: 0,
+ pendingId: suspenseId++,
timeout: typeof timeout === 'number' ? timeout : -1,
activeBranch: null,
pendingBranch: null,
:preview-options="{
customCode: {
importCode: `import { initCustomFormatter } from 'vue'`,
- useCode: `initCustomFormatter()`
- }
+ useCode: `initCustomFormatter()`,
+ },
}"
/>
</template>