Skip to content

Commit d6a01e1

Browse files
committed
test(plugin-detail): the 11815 pin reads the verdict from face and tooltip
A related list's table cell now paints the absolute face with the relative phrase as its title, so the per-row deadline pin asserts both. Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup Co-authored-by: Claude <noreply@anthropic.com>
1 parent ca66281 commit d6a01e1

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎ui/packages/plugin-detail/src/__tests__/RelatedList.deadlineSettled-11815.test.tsx‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import { describe, it, expect, vi, beforeAll, beforeEach, afterEach } from 'vitest';
1515
import { cleanup, render, waitFor } from '@testing-library/react';
1616
import * as React from 'react';
17+
import { formatDate } from '@object-ui/fields';
1718
import { RelatedList } from '../RelatedList';
1819

1920
beforeAll(() => {
@@ -79,16 +80,23 @@ const drawCell = (row: Record<string, unknown>) => {
7980
const col = (h.schema?.columns ?? []).find((c: any) => c.accessorKey === 'due_date');
8081
const { container } = render(<>{col.cell(row.due_date, row)}</>);
8182
const span = container.querySelector('span.tabular-nums') as HTMLElement | null;
82-
return { text: span?.textContent ?? '', red: !!span?.className.includes('text-red-600') };
83+
return {
84+
text: span?.textContent ?? '',
85+
title: span?.getAttribute('title') ?? '',
86+
red: !!span?.className.includes('text-red-600'),
87+
};
8388
};
8489

8590
describe('RelatedList — each child row is judged on its own (objectui#11815)', () => {
8691
it("an open row's declared deadline reads overdue, a done row's reads neutral", async () => {
8792
const ds = makeDataSource();
8893
renderList(ds);
8994
await waitFor(() => expect((h.schema?.columns ?? []).some((c: any) => c.accessorKey === 'due_date')).toBe(true));
90-
expect(drawCell(ROWS[0])).toEqual({ text: 'Overdue 5d', red: true });
91-
expect(drawCell(ROWS[1])).toEqual({ text: '5 days ago', red: false });
95+
// A table cell paints the absolute face and carries the relative phrase as
96+
// its tooltip (objectstack#26344), so the verdict reads in both.
97+
const absolute = formatDate(ROWS[0].due_date, undefined, { locale: 'en-US' });
98+
expect(drawCell(ROWS[0])).toEqual({ text: absolute, title: 'Overdue 5d', red: true });
99+
expect(drawCell(ROWS[1])).toEqual({ text: absolute, title: '5 days ago', red: false });
92100
});
93101

94102
it("asks for the settledWhen's operand when no column shows it", async () => {

0 commit comments

Comments
 (0)