♿️ feat: keep event actions menu visible
This commit is contained in:
@@ -124,7 +124,8 @@ export const EventCard = ({ event, onEdit, onDelete }: EventCardProps) => {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
className="h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity duration-150"
|
className="h-7 w-7 shrink-0 text-muted-foreground/70 hover:text-foreground"
|
||||||
|
aria-label="Event actions"
|
||||||
>
|
>
|
||||||
<MoreHorizontal className="h-3.5 w-3.5" />
|
<MoreHorizontal className="h-3.5 w-3.5" />
|
||||||
<span className="sr-only">Event actions</span>
|
<span className="sr-only">Event actions</span>
|
||||||
|
|||||||
31
tests/event-card.test.ts
Normal file
31
tests/event-card.test.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { describe, expect, test } from "bun:test";
|
||||||
|
import { renderToStaticMarkup } from "react-dom/server";
|
||||||
|
import { EventCard } from "@/components/event-card";
|
||||||
|
import type { CalendarEvent } from "@/lib/types";
|
||||||
|
|
||||||
|
const sampleEvent: CalendarEvent = {
|
||||||
|
id: "evt_1",
|
||||||
|
title: "Design Review",
|
||||||
|
start: "2026-04-09T10:00:00+00:00",
|
||||||
|
end: "2026-04-09T11:00:00+00:00",
|
||||||
|
description: "Review the updated event list UI.",
|
||||||
|
location: "Studio A",
|
||||||
|
url: "https://example.com/event",
|
||||||
|
allDay: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
describe("EventCard actions trigger", () => {
|
||||||
|
test("shows the triple-dots trigger without requiring hover and exposes an aria-label for the icon-only button", () => {
|
||||||
|
const markup = renderToStaticMarkup(
|
||||||
|
EventCard({
|
||||||
|
event: sampleEvent,
|
||||||
|
onEdit: () => {},
|
||||||
|
onDelete: () => {},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(markup).toContain('aria-label="Event actions"');
|
||||||
|
expect(markup).not.toContain("opacity-0");
|
||||||
|
expect(markup).not.toContain("group-hover:opacity-100");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user