Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

1.3 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0

import assert from "node:assert/strict";
import test from "node:test";

import { readSrc } from "./helpers/kit.ts";

test("gallery overlay actions follow interaction state instead of stale mouse focus", async () => {
  const [menu, imagesPage, videoPage] = await Promise.all([
    readSrc("components/gallery-item-menu.tsx"),
    readSrc("features/images/images-page.tsx"),
    readSrc("features/video/video-page.tsx"),
  ]);

  const closedClasses =
    /:\s*"([^"]*opacity-0[^"]*)"/.exec(menu)?.[1].split(" ") ?? [];
  assert.match(menu, /active && open\s*\n\s*\? "opacity-100"/);
  assert.ok(
    closedClasses.includes("group-hover:opacity-100"),
    "mouse hover must reveal the action",
  );
  assert.ok(
    closedClasses.includes("has-[button:focus-visible]:opacity-100"),
    "keyboard focus must reveal the action",
  );
  assert.ok(
    closedClasses.includes("pointer-coarse:opacity-100"),
    "touch users need a persistent action",
  );
  assert.ok(
    !closedClasses.includes("focus-within:opacity-100"),
    "plain restored focus must not reveal the action",
  );

  assert.doesNotMatch(imagesPage, /focus-within:opacity-100/);
  assert.doesNotMatch(videoPage, /focus-within:opacity-100/);
});