import { afterEach, describe, expect, it, vi } from "vitest"; import { buildRovingOrder, deriveAttributeLabel, getAttributeAccessibleName, getRovingTarget, isRtlContext, resolveRadioKey, } from "./radiogroup"; afterEach(() => { document.body.innerHTML = ""; document.documentElement.removeAttribute("dir"); vi.restoreAllMocks(); }); describe("deriveAttributeLabel", () => { it("strips attribute_/pa_ prefixes and title-cases", () => { expect(deriveAttributeLabel("attribute_pa_color")).toBe("Color"); expect(deriveAttributeLabel("attribute_size")).toBe("Size"); expect(deriveAttributeLabel("pa_shoe_size")).toBe("Shoe Size"); expect(deriveAttributeLabel("")).toBe(""); }); }); describe("getAttributeAccessibleName", () => { it("prefers the associated