Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

574 B
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */

import { describe, expect, it, vi } from "vitest";
import { raf2 } from "../focus-utils";

describe("raf2", () => {
  it("should call callback after two animation frames", async () => {
    const callback = vi.fn();

    raf2(callback);

    expect(callback).not.toHaveBeenCalled();

    await new Promise((resolve) => requestAnimationFrame(resolve));
    expect(callback).not.toHaveBeenCalled();

    await new Promise((resolve) => requestAnimationFrame(resolve));
    expect(callback).toHaveBeenCalledTimes(1);
  });
});