Skip to content

Commit 819ea87

Browse files
committed
test(record-page): pin the related tab's menu, the reset in 更多 and the fixed tabs; add the checklist item
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY
1 parent 671b1dc commit 819ea87

3 files changed

Lines changed: 292 additions & 5 deletions

File tree

‎docs/qa/platform-checklist/areas/records-forms.json‎

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7297,6 +7297,104 @@
72977297
"ref": "#35597"
72987298
}
72997299
]
7300+
},
7301+
{
7302+
"id": "records-forms.related-tab-arrangement",
7303+
"title": "A reader moves a related list's tab left or right and hides it from the tab's own menu, and 「更多」's 「恢复默认顺序」 brings the default back — kept per reader and object, in a drawer too; 概览, 附件, 审批 and 动态 never move",
7304+
"since": "v18.7",
7305+
"status": "active",
7306+
"revision": 1,
7307+
"priority": "P2",
7308+
"surface": "browser",
7309+
"personas": [
7310+
"seeded admin (admin@objectos.ai / admin123), signed in through the form"
7311+
],
7312+
"fixtures": {
7313+
"app": "showcase",
7314+
"requires": [
7315+
"a fresh boot of the showcase: `pnpm dev -- --fresh -p PORT --seed-admin`",
7316+
"a showcase_account record whose synthesized page has at least three side related lists (the Northwind account: contacts, opportunities, invoices and the rest the showcase derives); the zh-CN console (语言 中文) so the menu reads 左移 / 右移 / 隐藏"
7317+
]
7318+
},
7319+
"steps": [
7320+
"open the Northwind account's full record page at 1440×900 and read the tab row's order",
7321+
"open the second related list's tab, click it again to open its menu, choose 左移; then open the menu again and choose 右移",
7322+
"open another related list's tab, open its menu and choose 隐藏; open 「更多」 and read its hidden lists",
7323+
"reload the page and read the tab row and 「更多」",
7324+
"open 「更多」 and choose 恢复默认顺序; read the tab row",
7325+
"open the 概览, 附件, 审批 (while a request exists) and 动态 tabs in turn and click each again",
7326+
"open the same account in the record drawer, hide one list there from its tab's menu, then choose 恢复默认顺序 from the drawer's 「更多」"
7327+
],
7328+
"acceptance": [
7329+
{
7330+
"clause": "左移 and 右移 move the open list's tab one place among the related lists, and the menu's way out at either end is disabled",
7331+
"oracle": "dom",
7332+
"verify": "after 左移 the tab stands one place earlier in the row's role=tab order, after 右移 back; on the first list's tab 左移 is aria-disabled, on the last 右移",
7333+
"evidence": "the tab row read before and after each move"
7334+
},
7335+
{
7336+
"clause": "隐藏 takes the open list off the row into 「更多」's hidden lists and returns the page to 概览",
7337+
"oracle": "dom",
7338+
"verify": "the hidden list has no role=tab on the row; 「更多」 lists it under 已隐藏 (data-record-tab-hidden); 概览 is aria-selected",
7339+
"evidence": "the 「更多」 screenshot"
7340+
},
7341+
{
7342+
"clause": "the arrangement is the reader's, kept per object across a reload, the same store the related cards used (#27055)",
7343+
"oracle": "dom",
7344+
"verify": "after the reload the moved order and the hidden list stand as they were left",
7345+
"evidence": "the tab row after the reload"
7346+
},
7347+
{
7348+
"clause": "「更多」's 恢复默认顺序 restores the default order and shows every hidden list; in the default arrangement the entry is absent",
7349+
"oracle": "dom",
7350+
"verify": "after 恢复默认顺序 the row reads the order of steps[0] with no list hidden, and 「更多」 (if drawn at all) holds no 恢复默认顺序",
7351+
"evidence": "the tab row after the reset"
7352+
},
7353+
{
7354+
"clause": "概览, 附件, 审批 and 动态 are fixed: open, a second click opens no menu",
7355+
"oracle": "dom",
7356+
"verify": "none of the four tabs carries aria-haspopup, and no [data-record-tab-arrange-menu] opens",
7357+
"evidence": "one screenshot per tab"
7358+
},
7359+
{
7360+
"clause": "the drawer, which has no rail, moves, hides and resets the same way from its tab row",
7361+
"oracle": "dom",
7362+
"verify": "the drawer's 「更多」 holds 恢复默认顺序 after the hide, and choosing it shows the list again",
7363+
"evidence": "the drawer screenshot"
7364+
},
7365+
{
7366+
"clause": "the pins pass at the run subject sha",
7367+
"oracle": "test",
7368+
"verify": "run ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx and ui/packages/plugin-detail/src/synth/__tests__/relatedArrangement-27055.test.ts from ui/ with vitest, and ui/e2e/record-tabs-rail-35595.spec.ts with Playwright (Chromium); each reports ≥1 test and 0 failed",
7369+
"evidence": "the vitest and Playwright summary lines, with the subject sha"
7370+
}
7371+
],
7372+
"negative": [
7373+
"a menu on 概览, 附件, 审批 or 动态 is a FAIL: those tabs never move or hide",
7374+
"an arrangement that is gone after a reload is a FAIL: it is kept per reader and object",
7375+
"a drawer with a hidden list and no way to show it again is a FAIL"
7376+
],
7377+
"traps": [
7378+
"hydration-race"
7379+
],
7380+
"automated": {
7381+
"kind": "unit",
7382+
"ref": "ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx (move, hide, reset, the drawer, the fixed tabs), ui/packages/plugin-detail/src/synth/__tests__/relatedArrangement-27055.test.ts (the merge rules), ui/e2e/record-tabs-rail-35595.spec.ts (move, hide and reset with real pointer events in Chromium); no live spec drives the stored preference across a reload"
7383+
},
7384+
"source": [
7385+
"ui/packages/plugin-detail/src/RecordTabRow.tsx#RecordTabRow",
7386+
"ui/packages/plugin-detail/src/RecordPageColumns.tsx#RecordPageColumns",
7387+
"ui/packages/plugin-detail/src/synth/relatedArrangement.ts#editRelatedArrangement",
7388+
"#35783"
7389+
],
7390+
"history": [
7391+
{
7392+
"revision": 1,
7393+
"date": "2026-11-20",
7394+
"change": "initial — reader arrangement moved from the related cards to the tabs (#35783, after #35595 retired the cards), read from source on the PR branch; no live run made",
7395+
"ref": "#35783"
7396+
}
7397+
]
73007398
}
73017399
]
7302-
}
7400+
}

‎ui/e2e/record-tabs-rail-35595.spec.ts‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import { uiRoot } from '../scripts/ui-root.mjs';
2323
* strip; CONTROL, back on 概览 both are drawn again.
2424
* - A rail card's title opens its tab; CONTROL, the 概览 tab returns.
2525
* - A card measures radius 8, a 13 px title with a grey count, 26 px rows.
26+
* - objectstack#35783: an open list's tab is its menu — 「左移」 / 「右移」
27+
* move it, 「隐藏」 sends it to 「更多」 — and 「更多」's 「恢复默认顺序」
28+
* brings the default back. Order only: no width is read.
2629
*
2730
* ⚠️ A Playwright spec and not a vitest test: jsdom lays nothing out, so a
2831
* width read there is 0 and the row's fold — which reads the row's own width
@@ -589,3 +592,58 @@ test.describe('the record page\'s tabs and 概览 rail, zh-CN (objectstack#35595
589592
await expect(page.locator('[data-record-tab="approvals"]')).toHaveAttribute('aria-selected', 'true');
590593
});
591594
});
595+
596+
test.describe('a related tab\'s menu moves and hides it, and 「更多」 restores the default (objectstack#35783)', () => {
597+
test.skip(({ browserName }) => browserName !== 'chromium', 'one engine is enough for an interaction pin');
598+
599+
test.beforeAll(async () => {
600+
test.setTimeout(240_000);
601+
if (!bundle) bundle = await bundlePage();
602+
});
603+
604+
/** The related lists' tabs on the row, in order. */
605+
const listTabs = (page: Page) =>
606+
page.evaluate((all) => {
607+
const lists = new Set(all.slice(1, 9));
608+
return [...document.querySelectorAll('[data-record-tab-row] [role="tab"]')]
609+
.map((el) => el.getAttribute('data-record-tab') ?? '')
610+
.filter((id) => lists.has(id));
611+
}, ALL_TABS);
612+
/** Open a list's tab, then its menu (a second click), and choose an entry. */
613+
async function arrange(page: Page, id: string, entry: string) {
614+
const tab = page.locator(`[role="tab"][data-record-tab="${id}"]`);
615+
if ((await tab.getAttribute('aria-selected')) !== 'true') await tab.click();
616+
await expect(tab).toHaveAttribute('aria-selected', 'true');
617+
await tab.click();
618+
await page.getByRole('menuitem', { name: entry }).click();
619+
}
620+
621+
test('左移 / 右移 move the open list, 隐藏 sends it to 「更多」, 恢复默认顺序 brings the default back', async ({ page }, testInfo) => {
622+
test.setTimeout(120_000);
623+
const lists = ALL_TABS.slice(1, 9);
624+
await mount(page, { name: 'arrange1184', viewport: 1440, frame: PAGE_1440 });
625+
expect(await listTabs(page)).toEqual(lists);
626+
await arrange(page, 'contact.account_id', '右移');
627+
const moved = await listTabs(page);
628+
expect(moved.slice(0, 2)).toEqual(['opportunity.account_id', 'contact.account_id']);
629+
await arrange(page, 'contact.account_id', '左移');
630+
expect(await listTabs(page)).toEqual(lists);
631+
// CONTROL: 概览 opens no menu.
632+
await page.locator('[role="tab"][data-record-tab="overview"]').click();
633+
await page.locator('[role="tab"][data-record-tab="overview"]').click();
634+
await expect(page.locator('[data-record-tab-arrange-menu]')).toHaveCount(0);
635+
await arrange(page, 'quote.account_id', '右移');
636+
await arrange(page, 'opportunity.account_id', '隐藏');
637+
await expect(page.locator('[role="tab"][data-record-tab="overview"]')).toHaveAttribute('aria-selected', 'true');
638+
const arranged = await listTabs(page);
639+
report(testInfo, 'arranged', arranged);
640+
expect(arranged).not.toContain('opportunity.account_id');
641+
expect(arranged.indexOf('invoice.account_id')).toBeLessThan(arranged.indexOf('quote.account_id'));
642+
await page.locator('[data-record-tab-more]').click();
643+
await expect(page.locator('[data-record-tab-hidden][data-record-tab-menu-item="opportunity.account_id"]')).toHaveCount(1);
644+
await page.getByRole('menuitem', { name: '恢复默认顺序' }).click();
645+
await expect.poll(() => listTabs(page)).toEqual(lists);
646+
// CONTROL: the default arrangement offers nothing to restore, and the row that fits draws no 「更多」.
647+
await expect(page.locator('[data-record-tab-more]')).toHaveCount(0);
648+
});
649+
});

‎ui/packages/plugin-detail/src/__tests__/RecordPageColumns.readerArrangement-35595.test.tsx‎

Lines changed: 135 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313
* column is the 概览 tab's summary rail (objectstack#35596). The stored order
1414
* orders the tab row; a hidden list's tab waits at the end of 「更多 N ▾」;
1515
* the rail's foot keeps 「已隐藏 N 个 · 显示」, 「恢复默认顺序」 and the
16-
* changed-default hint. The card stack's ⠿ handle, ⌥↑ / ⌥↓, 隐藏 and the
17-
* 「新」 badge were the related cards' chrome and leave the page with them
18-
* (`RelatedCardStack`, no longer drawn by the page). This file carries over
16+
* changed-default hint. The card stack's ⠿ handle, ⌥↑ / ⌥↓ and the 「新」
17+
* badge left the page with the related cards; moving and hiding came back on
18+
* the tabs (objectstack#35783): an open list's tab is its menu — 「左移」,
19+
* 「右移」, 「隐藏」 — and 「更多」 ends with 「恢复默认顺序」 while the
20+
* arrangement is not the default, in a drawer too. This file carries over
1921
* `RelatedCardStack-27055.test.tsx`; the merge rules themselves stay pinned in
2022
* `synth/__tests__/relatedArrangement-27055.test.ts`.
2123
*/
2224

2325
import * as React from 'react';
2426
import { describe, it, expect, vi, afterEach } from 'vitest';
25-
import { render, cleanup, fireEvent } from '@testing-library/react';
27+
import { render, cleanup, fireEvent, screen } from '@testing-library/react';
28+
import userEvent from '@testing-library/user-event';
2629
import { RelatedListCompactContext, RelatedListEnlargedContext } from '../relatedListCompact';
2730

2831
vi.mock('@object-ui/react', async (importOriginal) => ({
@@ -184,3 +187,131 @@ describe('a related list\'s tab — ?related= (objectstack#27055, Target 9; obje
184187
expect(container.querySelector('[data-record-columns]')).not.toBeNull();
185188
});
186189
});
190+
191+
describe('a related tab\'s menu and 「更多」\'s reset (objectstack#35783)', () => {
192+
/** A host holding the store and the open tab, as the record page does. */
193+
function TabHost({ initial, onWrite, rail, columns = columnsOf() }: {
194+
initial?: RelatedArrangement;
195+
onWrite?: (v: RelatedArrangement) => void;
196+
rail?: boolean;
197+
columns?: ReturnType<typeof columnsOf>;
198+
}) {
199+
const [arrangement, setArrangement] = React.useState<RelatedArrangement | undefined>(initial);
200+
const [open, setOpen] = React.useState<string | undefined>(undefined);
201+
return (
202+
<RecordPageColumns
203+
tier="wide"
204+
columns={columns}
205+
rail={rail}
206+
relatedArrangement={arrangement}
207+
onRelatedArrangementChange={(next) => {
208+
onWrite?.(next);
209+
setArrangement(next);
210+
}}
211+
enlargedRelated={open}
212+
onEnlargeRelated={setOpen}
213+
onCloseEnlargedRelated={() => setOpen(undefined)}
214+
/>
215+
);
216+
}
217+
const tabEl = (id: string) => document.querySelector(`[role="tab"][data-record-tab="${id}"]`) as HTMLElement;
218+
/** Open `id`'s tab, then its menu, and choose `edit`. */
219+
async function arrange(user: ReturnType<typeof userEvent.setup>, id: string, edit: string) {
220+
if (tabEl(id).getAttribute('aria-selected') !== 'true') await user.click(tabEl(id));
221+
await user.click(tabEl(id));
222+
await user.click(await screen.findByRole('menuitem', { name: new RegExp(edit) }));
223+
}
224+
225+
it('「左移」 and 「右移」 move the open list one place and keep it; at either end the way out is disabled', async () => {
226+
const user = userEvent.setup();
227+
const onWrite = vi.fn();
228+
render(<TabHost onWrite={onWrite} />);
229+
await arrange(user, 'note.parent_id', 'Move left');
230+
expect(listTabs()).toEqual(['note.parent_id', 'task.lead_id', 'call.lead_id']);
231+
expect(onWrite.mock.calls.at(-1)![0].order).toEqual(['note.parent_id', 'task.lead_id', 'call.lead_id']);
232+
await arrange(user, 'task.lead_id', 'Move right');
233+
expect(listTabs()).toEqual(['note.parent_id', 'call.lead_id', 'task.lead_id']);
234+
// The last list cannot go further right; CONTROL, it can go left.
235+
await user.click(tabEl('task.lead_id'));
236+
expect((await screen.findByRole('menuitem', { name: /Move right/ })).getAttribute('aria-disabled')).toBe('true');
237+
expect(screen.getByRole('menuitem', { name: /Move left/ }).hasAttribute('aria-disabled')).toBe(false);
238+
});
239+
240+
it('「隐藏」 takes the open list off the row into 「更多」\'s hidden lists and returns to 概览', async () => {
241+
const user = userEvent.setup();
242+
const onWrite = vi.fn();
243+
const { container } = render(<TabHost onWrite={onWrite} />);
244+
await arrange(user, 'note.parent_id', 'Hide');
245+
expect(listTabs()).toEqual(['task.lead_id', 'call.lead_id']);
246+
expect(onWrite.mock.calls.at(-1)![0].hidden).toEqual(['note.parent_id']);
247+
expect(tabEl('overview').getAttribute('aria-selected')).toBe('true');
248+
expect(container.querySelector('[data-related-enlarged]')).toBeNull();
249+
await user.click(document.querySelector('[data-record-tab-more]') as HTMLElement);
250+
const hiddenItem = (await screen.findAllByRole('menuitem')).find((el) => el.hasAttribute('data-record-tab-hidden'));
251+
expect(hiddenItem?.getAttribute('data-record-tab-menu-item')).toBe('note.parent_id');
252+
});
253+
254+
it('「更多」 ends with 「恢复默认顺序」 while the arrangement is not the default: the default order, every list shown — in a drawer too', async () => {
255+
const user = userEvent.setup();
256+
const onWrite = vi.fn();
257+
const moved = editRelatedArrangement(DEFAULT, undefined, { kind: 'move', id: 'call.lead_id', to: 0 }, Date.now());
258+
const both = editRelatedArrangement(DEFAULT, moved, { kind: 'hide', id: 'task.lead_id' }, Date.now());
259+
const { container } = render(<TabHost initial={both} onWrite={onWrite} rail={false} />);
260+
// A drawer: no rail, so no foot line — 「更多」 is the one way back.
261+
expect(container.querySelector('[data-related-foot-line]')).toBeNull();
262+
expect(listTabs()).toEqual(['call.lead_id', 'note.parent_id']);
263+
await user.click(document.querySelector('[data-record-tab-more]') as HTMLElement);
264+
await user.click(await screen.findByRole('menuitem', { name: 'Restore default order' }));
265+
expect(listTabs()).toEqual(DEFAULT);
266+
expect(onWrite.mock.calls.at(-1)![0]).toMatchObject({ order: [], hidden: [] });
267+
// CONTROL: in the default arrangement there is nothing to restore, and a row that fits draws no 「更多」.
268+
expect(document.querySelector('[data-record-tab-more]')).toBeNull();
269+
});
270+
271+
it('a row moved but nothing hidden still offers the reset, under a bare 「更多」', async () => {
272+
const user = userEvent.setup();
273+
const moved = editRelatedArrangement(DEFAULT, undefined, { kind: 'move', id: 'call.lead_id', to: 0 }, Date.now());
274+
render(<TabHost initial={moved} />);
275+
const trigger = document.querySelector('[data-record-tab-more]') as HTMLElement;
276+
expect(trigger.textContent).toBe('More');
277+
await user.click(trigger);
278+
expect((await screen.findAllByRole('menuitem')).map((el) => el.textContent)).toEqual(['Restore default order']);
279+
});
280+
281+
it('概览, 附件, 审批 and 动态 are fixed: open, they have no menu; CONTROL, an open list\'s tab has one', async () => {
282+
const user = userEvent.setup();
283+
const columns = buildDefaultPageColumns(
284+
buildDefaultPageSchema({ name: 'lead', fields: {}, enable: { files: true } } as any, {
285+
related: RELATED,
286+
hideDiscussion: false,
287+
approvals: { count: 1, node: { approvals: { available: true, requests: [{ id: 'r1' }] } } },
288+
}),
289+
)!;
290+
render(<TabHost columns={columns} />);
291+
const fixed = ['overview', 'attachments', 'approvals', 'timeline'];
292+
for (const id of fixed) {
293+
expect(tabEl(id), id).not.toBeNull();
294+
if (tabEl(id).getAttribute('aria-selected') !== 'true') await user.click(tabEl(id));
295+
expect(tabEl(id).getAttribute('aria-selected')).toBe('true');
296+
await user.click(tabEl(id));
297+
expect(tabEl(id).hasAttribute('aria-haspopup'), id).toBe(false);
298+
expect(document.querySelector('[data-record-tab-arrange-menu]'), id).toBeNull();
299+
}
300+
await user.click(tabEl('call.lead_id'));
301+
await user.click(tabEl('call.lead_id'));
302+
expect(tabEl('call.lead_id').getAttribute('aria-haspopup')).toBe('menu');
303+
expect(document.querySelector('[data-record-tab-arrange-menu="call.lead_id"]')).not.toBeNull();
304+
});
305+
306+
it('a list\'s tab not yet open opens on its first click and on Enter, with no menu', async () => {
307+
const user = userEvent.setup();
308+
render(<TabHost />);
309+
await user.click(tabEl('note.parent_id'));
310+
expect(tabEl('note.parent_id').getAttribute('aria-selected')).toBe('true');
311+
expect(document.querySelector('[data-record-tab-arrange-menu]')).toBeNull();
312+
tabEl('call.lead_id').focus();
313+
await user.keyboard('{Enter}');
314+
expect(tabEl('call.lead_id').getAttribute('aria-selected')).toBe('true');
315+
expect(document.querySelector('[data-record-tab-arrange-menu]')).toBeNull();
316+
});
317+
});

0 commit comments

Comments
 (0)