/** * useStyleTag - Browser Mode Spec * * Runs in real Playwright Chromium (not jsdom). * Verifies that style tags are actually injected into the real DOM * and that CSS rules are correctly applied to elements. */ import { renderHook, act, waitFor } from "@testing-library/react"; import { describe, it, expect, afterEach } from "vitest"; import { useStyleTag } from "."; // --------------------------------------------------------------------------- // Helpers // --------------------------------------------------------------------------- let styleIds: string[] = []; function nextId(): string { const id = `usels-browser-test-${styleIds.length}`; styleIds.push(id); return id; } afterEach(() => { styleIds.forEach((id) => document.getElementById(id)?.remove()); styleIds = []; }); // --------------------------------------------------------------------------- // Tests // --------------------------------------------------------------------------- describe("useStyleTag() — real browser", () => { it("runs in an actual browser environment (not jsdom)", () => { expect(typeof window).toBe("object"); expect(typeof document.createElement).toBe("function"); expect(typeof document.head.appendChild).toBe("function"); }); it("injects a real