Skip to content

Commit 919a2f4

Browse files
committed
test(plugin-grid): pin the markdown cell face inside the one-line clamp; add changeset
Claude-Session: https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds Co-authored-by: Claude <noreply@anthropic.com>
1 parent 75716ff commit 919a2f4

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/fields': patch
3+
---
4+
5+
fix(fields): a markdown value that starts with a heading no longer draws at heading size in a list cell
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
In a grid column (list views and related lists pass `inGridColumn`), the `markdown` cell now draws its value in a cell face: a heading is a bold line at the cell's own text size instead of a heading element, and the body takes the cell's font size and line height. A value such as `# Heading` showed a truncated H1 and grew its row; the row now keeps the height of every other row. The record page and readonly form fields keep the full document face and its heading sizes. Nothing changes in what an author writes, and no export changes.

‎ui/packages/plugin-grid/src/__tests__/ObjectGrid.richTextOneLine-12480.test.tsx‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,36 @@ describe('objectui#12480 — a rich-content cell keeps the one-line row', () =>
157157
expect(screen.getByText('Account 8').closest('td')?.querySelector('.truncate')).not.toBeNull();
158158
});
159159
});
160+
161+
/**
162+
* objectstack#36344 — the one line the clamp shows is a line of the cell's
163+
* text. A markdown value that starts with `# Heading` filled the clamp's one
164+
* line with an H1, so the row grew to the heading's line height. The grid
165+
* passes `inGridColumn` to every column cell, and the markdown cell then draws
166+
* its value in the `cell` face: no heading element, the cell's own font size
167+
* and line height. jsdom does no layout; the pixel readings are in the PR.
168+
*/
169+
describe('objectstack#36344 — a markdown heading in a grid cell does not draw at heading size', () => {
170+
it('a markdown cell whose value starts with a heading draws no heading element inside the clamp', async () => {
171+
desktop();
172+
const rows = [
173+
{ id: 'r1', name: 'Account 1', description: '# Heading\n\nBody' },
174+
{ id: 'r2', name: 'Account 2' },
175+
];
176+
renderGrid(rows, [
177+
{ field: 'name', label: 'Name' },
178+
{ field: 'description', label: 'Description' },
179+
]);
180+
await waitFor(() => expect(screen.getByText('Account 2')).toBeInTheDocument());
181+
const row1 = bodyRows()[0] as HTMLElement;
182+
const face = await waitFor(() => {
183+
const el = row1.querySelector<HTMLElement>('[data-testid="grid-rich-text-one-line"] [data-markdown-face]');
184+
if (!el) throw new Error('markdown cell not rendered yet');
185+
return el;
186+
});
187+
expect(face).toHaveAttribute('data-markdown-face', 'cell');
188+
expect(face).toHaveClass('text-[length:inherit]', 'leading-[inherit]');
189+
expect(face.querySelector('[data-markdown-heading]')).toHaveTextContent('Heading');
190+
expect(document.querySelector('tbody h1, tbody h2, tbody h3, tbody h4, tbody h5, tbody h6')).toBeNull();
191+
});
192+
});

0 commit comments

Comments
 (0)