fix(files): the token list is fresh after the sessions end, a copy again reads Copied again, the Copied button says so
This commit is contained in:
@@ -32,6 +32,18 @@ describe("useCopyFeedback", () => {
|
||||
expect(result.current.copied).toBe(false);
|
||||
});
|
||||
|
||||
it("a copy again within the moment reads Copied for a whole moment again", async () => {
|
||||
vi.useFakeTimers();
|
||||
const { result } = renderHook(() => useCopyFeedback());
|
||||
await act(() => result.current.copy("sfl_x"));
|
||||
act(() => void vi.advanceTimersByTime(1500));
|
||||
await act(() => result.current.copy("sfl_x"));
|
||||
act(() => void vi.advanceTimersByTime(1000)); // past the first copy's moment
|
||||
expect(result.current.copied).toBe(true);
|
||||
act(() => void vi.advanceTimersByTime(1000));
|
||||
expect(result.current.copied).toBe(false);
|
||||
});
|
||||
|
||||
it("a copy the clipboard refused is a warning, and nothing reads Copied", async () => {
|
||||
h.copyText.mockResolvedValueOnce(false);
|
||||
const { result } = renderHook(() => useCopyFeedback());
|
||||
|
||||
Reference in New Issue
Block a user