Finalize the Effect View rename and refresh docs, examples, and tooling #59

Merged
Thilawyn merged 12 commits from next into master 2026-07-27 04:11:42 +02:00
2 changed files with 16 additions and 8 deletions
Showing only changes of commit f7a77f4c8a - Show all commits
+8 -4
View File
@@ -273,6 +273,7 @@ describe("Component", () => {
)
await screen.findByText("first")
vi.useFakeTimers()
view.rerender(
<runtime.context.Provider value={effectRuntime}>
@@ -280,16 +281,19 @@ describe("Component", () => {
</runtime.context.Provider>
)
await screen.findByText("second")
expect(screen.getByText("second")).toBeTruthy()
expect(cleanup).not.toHaveBeenCalled()
await new Promise(resolve => setTimeout(resolve, 5))
await vi.advanceTimersByTimeAsync(19)
expect(cleanup).not.toHaveBeenCalled()
await waitFor(() => expect(cleanup).toHaveBeenCalledWith("first"), { timeout: 100 })
await vi.advanceTimersByTimeAsync(1)
expect(cleanup).toHaveBeenCalledWith("first")
view.unmount()
await waitFor(() => expect(cleanup).toHaveBeenCalledWith("second"), { timeout: 100 })
await vi.advanceTimersByTimeAsync(20)
expect(cleanup).toHaveBeenCalledWith("second")
vi.useRealTimers()
await Effect.runPromise(runtime.runtime.disposeEffect)
})
+8 -4
View File
@@ -277,6 +277,7 @@ describe("Component", () => {
)
await screen.findByText("first")
vi.useFakeTimers()
view.rerender(
<runtime.context.Provider value={effectRuntime}>
@@ -284,16 +285,19 @@ describe("Component", () => {
</runtime.context.Provider>
)
await screen.findByText("second")
expect(screen.getByText("second")).toBeTruthy()
expect(cleanup).not.toHaveBeenCalled()
await new Promise(resolve => setTimeout(resolve, 5))
await vi.advanceTimersByTimeAsync(19)
expect(cleanup).not.toHaveBeenCalled()
await waitFor(() => expect(cleanup).toHaveBeenCalledWith("first"), { timeout: 100 })
await vi.advanceTimersByTimeAsync(1)
expect(cleanup).toHaveBeenCalledWith("first")
view.unmount()
await waitFor(() => expect(cleanup).toHaveBeenCalledWith("second"), { timeout: 100 })
await vi.advanceTimersByTimeAsync(20)
expect(cleanup).toHaveBeenCalledWith("second")
vi.useRealTimers()
await runtime.runtime.dispose()
})