32 lines · 1.1 KB · TypeScript
RawDownload
import { describe, expect, it } from "vite-plus/test"; import { beginForegroundHandoff, isForegroundHandoffActive } from "./foreground-handoff"; describe("foreground handoff", () => {  it("is active only while a handoff is open", () => {    expect(isForegroundHandoffActive()).toBe(false);    const end = beginForegroundHandoff();    expect(isForegroundHandoffActive()).toBe(true);    end();    expect(isForegroundHandoffActive()).toBe(false);  });   it("stays active until every overlapping handoff ends", () => {    const endFirst = beginForegroundHandoff();    const endSecond = beginForegroundHandoff();    endFirst();    expect(isForegroundHandoffActive()).toBe(true);    endSecond();    expect(isForegroundHandoffActive()).toBe(false);  });   it("tolerates an end function called twice", () => {    const endFirst = beginForegroundHandoff();    const endSecond = beginForegroundHandoff();    endFirst();    endFirst();    expect(isForegroundHandoffActive()).toBe(true);    endSecond();    expect(isForegroundHandoffActive()).toBe(false);  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t