Skip to content

Commit a6756a2

Browse files
feat(record-page): the field area is one list in the side preview, on a phone and in the pinned left column (#36147) (#36234)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> Fixes #36147 _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuSuiLqQhyEd4RmCmzfMdhFV)_ repo:objectstack#1 · os-sales · session_01L6bhgWmyKFrcthV9y5wUiP Part of epic #35590 (record page redo). One PR for the card. Claim 7066162109; Sales ruled "all as the card says" (7066516044). Clause-②: yes (widening): `@object-ui/fields` exports a new `ReferenceChipContext` (a boolean React context, default `false`); `@object-ui/i18n` gains five keys in every pack (`detail.systemInfo`, `detail.createdTime`, `detail.updatedTime`, `detail.recordNumber`, `detail.clickToEdit`). No prop, export or schema key is removed or narrowed. The field-list context (`RecordFieldListContext`) is module-internal to `@object-ui/plugin-detail`, not in its barrel. Metadata-protocol: none ## 维护者速读 - 抽屉、手机「详情」页签、宽屏钉住的左栏,字段区现在是同一个列表:一行一个字段,标签在左、值在右,行间细线;任何宽度都是一列。只有「整页且没有其他页签」的记录页仍按宽度多列。 - 分组标题在左,箭头在最右(收起朝下、展开朝上),整行可点。 - 查找字段显示成带对象颜色图标的标签,名字完整换行不截断;点标签打开那条记录,点同一行其他地方是编辑。 - 所有分组的空字段合成列表最后一行「显示 N 个空字段」,选择按对象记住。 - 「系统信息」是最后一个分组,默认收起(创建人、创建时间、修改人、修改时间、负责人〔正文没画时〕、记录编号)。**它在这个页面上替代了 objectui#12307 加的底部一行元信息**;别处那一行不变。 - 不再有铅笔:单击可编辑的值就进入编辑,不再需要双击;**只读值单击不再复制**(悬停或键盘聚焦时的复制图标还在)。 - 手机上原来的 iOS 分组卡片样式在这里去掉了,和抽屉一样的行;手机上只读值不再出现复制图标(长按选中文字)。 - 箭头只出现在对象声明为「可折叠」的分组上(字段分组默认不可折叠,CRM 的分组都是这样),默认分组不加箭头,不改元数据约定;「系统信息」总是可折叠。 - 桌面上能看到的变化:有其他页签的整页(例如商机,有产品明细等页签)「详情」从按宽度 3 列变成 1 列。 ## What changes All on the synthesized (default) record page's field area, which is `DetailSection`'s frameless face in all three places (side preview / split pane, phone 「详情」 tab, wide page's pinned left column). Authored record pages and every other `DetailView` keep their faces. 1. **One shared list, one column at any width (items 1, 2, 8).** `RecordPageColumns` now sets `DetailsColumnCapContext` to 1 everywhere except a full page whose details are its only face (no other tab, none hidden), which keeps 3. Under the cap of 1 the section draws one column of label-left rows with a hairline between them (`data-detail-section-list`). The phone's iOS grouped-inset branch no longer applies to the frameless face, so the phone draws the same rows. The phone's two-column highlights block was already gone on the default page (#35891); nothing is drawn in its place. 2. **Group title row (item 3).** Title left, chevron at the row's right end: `ChevronDown` folded, `ChevronUp` open; the whole row is the toggle (`aria-expanded`). 3. **Reference chips (item 4).** Inside the frameless section `ReferenceChipContext` is `true`, and `LookupCellRenderer`'s `ReferencedRecordLink` draws a pill: the referenced object's `ObjectIconTile` (`ObjectSchema.color` / `icon`, #35985) and the whole name, `break-words`, not truncated. It is still the same anchor (same `href`, same `openRecord` click, `stopPropagation`), so a click opens the record and is not the row's; with no route it is a plain pill. Outside the context the link face is unchanged. 4. **Empty fields in one last row (item 5).** Under the laid-out page each section hides its empty rows and reports the count to a per-page tally (`recordFieldList.ts`, the `recordBodyFields.ts` store pattern: `useId` + layout effect, read with `useSyncExternalStore`). `EmptyFieldsRow` closes the details column with 「显示 N 个空字段」 / 「隐藏空字段」. The choice is the existing per-object record-page preference `showEmptyFields` (#25883). This replaces, on this page only, each section's own toggle and `DetailView`'s 「N 个空分组」 line. An authored `hideEmpty` section stays hidden and is not counted; an all-empty group draws nothing until the reader shows empties. 5. **「系统信息」 last group (item 6).** Under the field list, `RecordMetaFooter` draws a folded `DetailSection` titled 系统信息 with one read-only row per fact: created by, created on, updated by and updated on (only when the record was updated), the owner (only when neither the strip nor the body draws it, the #28868 / #35941 owner-once rule unchanged) and the record ID. **This reverses objectui#12307's one-line meta footer on the laid-out record page**, as the card asks; outside the field list (print, embedded `DetailView`, authored pages) the line is unchanged. The group is wrapped so its rows do not report as body fields. 6. **Click to edit, no pencil (item 7).** On the frameless face a single click on an editable value calls `onEnterInlineEdit`, unless the click lands on a link, button, input or `role=button|link|checkbox` inside the value, or the reader has a text selection in the row. The pencil `Button` stays in the DOM as `sr-only` and shows on `focus-visible`, so keyboard users keep a way in; the title hint reads "Click to edit". Double-click is no longer wired there. The pencil, its tooltip and the value's title are named for the gesture that works there, `detail.clickToEdit` ("Click to edit" / 点击编辑); every other face keeps `detail.editInlineHint`. Read-only values no longer copy on click (`copyInteractive` is off for frameless). The copy icon stays for a mouse (hover / keyboard focus) and is `pointer-coarse:hidden` on the field list, so a phone shows no copy icon (ruling 1): a tap would otherwise set `:hover` and reveal it. An editable lookup: the chip opens the record (#36015 precedent), the rest of the row edits. Dev-thread calls (no card needed under the 22:19Z rule): - **Item 3 reads the authored contract.** The chevron and the whole-row toggle are drawn for a group that folds: a field group the object declares `collapse: 'collapsed' | 'expanded'`, and 系统信息. A field group's spec default is `collapse: 'none'` ("always open, no toggle"), so on CRM (商机, 其他) no group has an arrow. Making `none` groups foldable would override authored metadata, so it is not done here; that would be a separate question for the seat. A declared foldable group (showcase Semantic Zoo, 财务信息) is shown folded and open in the evidence comment. - Items 3–7 apply to the whole default-page frameless face, including the multi-column full page with no other tabs, so the page has one behaviour. - The empty-fields row sits after 系统信息, as the column's last row. - `RecordDetailView.tsx` is not touched (#36151, #36149 + #36201 wait on this merge). ## Card checklist - One shared field area for drawer / phone / pinned left column. ✔ (`DetailSection.fieldList-36147`, `RecordPageColumns.test.tsx` new describe) - One column at any width; full page with no other tabs keeps multi-column. ✔ (cap tests at drawer / pinned / full-page-alone; browser: drawer 2→1, opportunity full page 3→1) - Group chevron at the right, down folded / up open, whole row toggles. ✔ - Lookup values are object-colour chips; click opens the record. ✔ (`referenceChip-36147`; browser href) - Empty fields in one collapsed last row. ✔ (count, toggle, withdraw on unmount, authored hide not counted, outside-list control) - 系统信息 last, collapsed by default. ✔ (`RecordMetaFooter.systemInfo-36147`, control: outside the list the line is unchanged) - No pencil; click edits; read-only takes no click. ✔ (unit + browser on desktop and iPhone 12 emulation) - No two-column highlights on phone. ✔ (already none on the default page; the phone face is the same rows) ## Verification - `vitest run packages/plugin-detail`: 406 files / 3,749 tests pass (18 skipped, existing), re-run after the L1-d rework. `vitest run packages/fields`: 321 files / 4,821 pass (7 skipped). - App-shell and console tests that mount the record page (247 files picked by `RecordDetailView|RecordPageColumns|record-meta-footer|data-detail-field|…`): 2,092 / 2,099 passed first time; the 7 failures were the two owner-once files that read the meta line (`RecordDetailView.phoneOwnerLine-28909`, `RecordMetaFooter.ownerOnceBody-35941`). They now open 系统信息 and read its Owner / Record ID rows, with the same owner-once assertions; 9 / 9 pass. - `type-check` (src and tests) clean for plugin-detail and fields; full `pnpm build` (console `tsc` included) passes; ESLint on every changed file: 0 errors; `check:new-line-citations`: 0 new. - E2E `record-flow-phone-targets` (CI E2E UI) now reads the pencil classes from the module constants `PENCIL_CLASS` / `FIELD_LIST_PENCIL_CLASS` instead of a JSX attribute pattern, and gains one test: on a 375 px touch screen the field list's pencil is 1×1 px until a keyboard focuses it, then drawn at its size (6 / 6 pass locally; the new one failed before the class was given explicit `h-px w-px`). - Live e2e `inline-edit-polish-2572` (not in the CI live list) is updated from double-click to click and the "Click to edit" hint. `read-only-member-record` and `RecordDetailView.harness` count pencils by name and now accept the field list's click name; the admin control counts the `sr-only` pencil instead of asking it to be visible. - Browser (examples/app-crm, zh-CN): before / after shots of the drawer at 768 / 1024 / 1440 windows, the opportunity full page at 1440, the account's pinned left column at 1440 (also with 系统信息 opened), and the phone at 375 are in the project thread. A single click or tap on 金额 opens its editor; a click or tap on a read-only value does nothing; read-only values are `user-select: auto` with no click or touch handler, so the phone's native long-press selection applies. **NOT MEASURED on a physical phone:** that long-press selects a read-only value (ruling 1) was checked only by source (no handler, no `select-none`) and in emulation; it is owed to the first hosted phone reading. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No `packages/spec` change.) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; lint passes on the changed files. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset (`.changeset/36147-record-field-list.md`), and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: not touched. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English (the 维护者速读 block is the maintainer's summary, in the maintainer's language). - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgWmyKFrcthV9y5wUiP)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgWmyKFrcthV9y5wUiP <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgWmyKFrcthV9y5wUiP --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a60740a commit a6756a2

30 files changed

Lines changed: 1134 additions & 61 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@object-ui/plugin-detail': patch
3+
'@object-ui/fields': patch
4+
'@object-ui/i18n': patch
5+
---
6+
7+
feat(console): the record page's field area is one list — one field a row in the side preview, on a phone and in the wide page's pinned left column
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
The synthesized record page's field area (objectstack#36147, ruling on the card 7066516044):
13+
14+
- **One column at any width.** The drawer (at any width), the split pane, the phone's 「详情」 tab, the wide page's pinned left column and a desktop full page that has other tabs but is not pinned (an opportunity's 详情 tab goes from three columns to one) draw the fields one a row: label left, value right, a hairline between rows. The phone's own grouped-inset face is gone there; it is the same list. A full page whose details are its only face (no other tab, none hidden) keeps laying a group out by width.
15+
- **Group title row.** The title sits left and its chevron at the row's right end, pointing down while the group is folded and up while it is open; the whole row toggles.
16+
- **Referenced records are chips.** A lookup value is drawn as a pill with the referenced object's colour tile (`ObjectSchema.color` / `icon`, objectstack#35985) and the record's whole name, wrapping rather than cut. A click on the chip opens the record; the rest of an editable lookup's row edits it. Everywhere else a reference keeps its link face.
17+
- **Empty fields fold into one row.** Every empty field of every group is folded into the list's one last row (「显示 N 个空字段」), replacing the per-group toggle and the 「N 个空分组」 line on this page. The reader's choice is the per-object record-page preference `showEmptyFields` (objectstack#25883), so it holds for the next record of the object. An authored `hideEmpty` group stays hidden and is not counted.
18+
- **「系统信息」 is the last group,** folded until opened: created by, created on, updated by, updated on (when the record was updated), the owner (when the body does not draw it) and the record ID, one fact a row. On this page it **replaces the one-line meta footer that objectui#12307 introduced**; outside the laid-out record page that line is unchanged.
19+
- **A click edits; no pencil.** A single click on an editable value enters edit (a click on a link, a button or a text selection inside it is not taken); the hover pencil is no longer drawn, and stays in the DOM only as the keyboard's way in (visible on focus). A double click is no longer needed. **A read-only value takes no click any more**: the click-to-copy on read-only rows is removed on this page. For a mouse or a keyboard its copy icon, shown on hover or keyboard focus, stays; a touch screen shows none, and the value is selected by a long press.
20+
- Authored record pages and every other DetailView keep their faces.
21+
22+
`@object-ui/fields` widens: it exports `ReferenceChipContext` (a boolean React context, default `false`) that switches `LookupCellRenderer`'s reference link to the chip face.
23+
24+
`@object-ui/i18n` widens: five new keys in every pack, `detail.systemInfo` (系统信息 / System information), `detail.createdTime`, `detail.updatedTime`, `detail.recordNumber` and `detail.clickToEdit`.

‎ui/e2e/live/inline-edit-polish-2572.spec.ts‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ const REPO_ROOT = decodeURIComponent(new URL(import.meta.url).pathname)
5656
.slice(0, -SELF_DEPTH_BELOW_REPO_ROOT)
5757
.join('/');
5858

59-
const EDIT_HINT = 'Double-click to edit';
59+
// The record page's field list enters edit on a click of the value
60+
// (objectstack#36147); the value carries this title.
61+
const EDIT_HINT = 'Click to edit';
6062

6163
function authToken(): string {
6264
const state = JSON.parse(readFileSync(join(REPO_ROOT, 'e2e/live/.auth/state.json'), 'utf8'));
@@ -117,12 +119,12 @@ test('record inline-edit polish (#2572) — showcase Project end-to-end', async
117119
if (/\/api\/v1\/data\/showcase_account\/[^/?]+/.test(r.url())) accountHydrations.push(r.url());
118120
});
119121

120-
// ── Enter the shared inline-edit session (double-click a details-body field). ──
122+
// ── Enter the shared inline-edit session (click a details-body field). ──
121123
const spentGroup = page
122124
.locator('div.group')
123125
.filter({ has: page.getByText('Spent', { exact: true }) })
124126
.last();
125-
await spentGroup.locator(`[title="${EDIT_HINT}"]`).dblclick();
127+
await spentGroup.locator(`[title="${EDIT_HINT}"]`).click();
126128

127129
const saveBtn = page.getByRole('button', { name: 'Save', exact: true });
128130
await expect(saveBtn, 'save bar appears once the session is live').toBeVisible();
@@ -149,7 +151,7 @@ test('record inline-edit polish (#2572) — showcase Project end-to-end', async
149151
.locator('div.group')
150152
.filter({ has: page.getByText('Budget', { exact: true }) })
151153
.last();
152-
await budgetGroup.locator(`[title="${EDIT_HINT}"]`).dblclick();
154+
await budgetGroup.locator(`[title="${EDIT_HINT}"]`).click();
153155
await expect(saveBtn).toBeVisible();
154156
const budgetInput2 = page.locator('input[type="number"][min="0"][step="0.01"]').first();
155157
// Above the flow's 500k decision edge, so approving `manager_review` routes
@@ -220,7 +222,7 @@ test('record inline-edit polish (#2572) — showcase Project end-to-end', async
220222
await expect(approvalTag, 'the header names the pending approval').toBeVisible();
221223
await expect(approvalTag, 'an unlocked approval step does not lock the tag').not.toHaveAttribute('data-record-approval-locked');
222224
// A double-click on the budget still opens an inline-edit session.
223-
await budgetGroupOnPage().locator(`[title="${EDIT_HINT}"]`).dblclick();
225+
await budgetGroupOnPage().locator(`[title="${EDIT_HINT}"]`).click();
224226
await expect(saveBtn, 'inline editing stays live during an unlocked approval').toBeVisible();
225227
await page.keyboard.press('Escape');
226228
await expect(saveBtn).toBeHidden();
@@ -261,7 +263,7 @@ test('record inline-edit polish (#2572) — showcase Project end-to-end', async
261263
await expect(approvalTag, 'the header names the locking approval').toBeVisible();
262264
await expect(approvalTag, 'the approval tag carries the lock').toHaveAttribute('data-record-approval-locked', '');
263265

264-
// …and a double-click on the (former) budget field must NOT open a session.
265-
await budgetGroupOnPage().dblclick();
266+
// …and a click on the (former) budget field must NOT open a session.
267+
await budgetGroupOnPage().click();
266268
await expect(saveBtn).toBeHidden();
267269
});

‎ui/e2e/live/read-only-member-record.spec.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ const writesInquiry = writesRecordsOf(OBJECT);
3939

4040
// The record header's Edit CTA and the record body's inline-edit pencils carry
4141
// no test id; their accessible names are the `detail.edit` and
42-
// `detail.editInlineHint` strings, en or zh.
42+
// `detail.editInlineHint` strings, en or zh, or `detail.clickToEdit` on the
43+
// record page's field list (objectstack#36147), where the pencil is the
44+
// keyboard's way in, `sr-only` until focused, so it is counted, not seen.
4345
const editButton = (page: Page) => page.getByRole('button', { name: /^(Edit|编辑)$/ });
44-
const inlineEditPencils = (page: Page) => page.getByRole('button', { name: /^(Double-click to edit|双击编辑)$/ });
46+
const inlineEditPencils = (page: Page) =>
47+
page.getByRole('button', { name: /^(Double-click to edit|双击编辑|Click to edit|点击编辑)$/ });
4548

4649
test.use({ viewport: { width: 1440, height: 900 } });
4750

@@ -116,7 +119,7 @@ test('a member who may read but not write an inquiry gets a read-only form and n
116119
await test.step('control, as the admin: the same form is editable and its save persists', async () => {
117120
await page.goto(recordPath(id));
118121
await expect(editButton(page)).toBeVisible({ timeout: 30_000 });
119-
await expect(inlineEditPencils(page).first()).toBeVisible();
122+
await expect.poll(() => inlineEditPencils(page).count(), { timeout: 30_000 }).toBeGreaterThan(0);
120123

121124
await page.goto(formPath(id));
122125
const dialog = page.getByRole('dialog');

‎ui/e2e/record-flow-phone-targets.spec.ts‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ import { uiRoot } from '../scripts/ui-root.mjs';
2222
* `min-h-[44px] sm:min-h-0` spellings) and shows the pencil on a coarse
2323
* pointer. Above `sm` every control keeps its desktop size.
2424
*
25+
* On the synthesized record page's field list (objectstack#36147) a phone
26+
* enters edit by tapping the value, and no pencil is drawn there: the pencil
27+
* measured here is the one every other face of a section still draws
28+
* (`PENCIL_CLASS`), and the field list's own button (`FIELD_LIST_PENCIL_CLASS`)
29+
* is the keyboard's way in, `sr-only` until focused.
30+
*
2531
* ⚠️ A Playwright spec and not a vitest test for the reason
2632
* `record-path-phone-row.spec.ts` gives: jsdom has no layout engine, so a
2733
* size read there is 0 and an assertion on it is vacuous.
@@ -86,7 +92,8 @@ const CLS = {
8692
cardRowName: g('related', /className="(min-h-11 [^"]*text-primary hover:underline[^"]*)"/, ['min-h-11', 'sm:min-h-0']),
8793
cardMenu: g('cardMenu', /className="([^"]+)"\s*aria-label=\{t\('detail\.relatedCardMenu'/, ['h-11', 'w-11', 'sm:h-6']),
8894
cardHandle: g('cardMenu', /'(inline-flex h-11 w-11 [^']*)'/, ['h-11', 'w-11', 'sm:h-6']),
89-
pencil: g('section', /className="([^"]+)"\s*aria-label=\{t\('detail\.editInlineHint'\)\}/, ['min-h-[44px]', 'pointer-coarse:opacity-100', 'opacity-0']),
95+
pencil: g('section', /const PENCIL_CLASS =\s*'([^']+)'/, ['min-h-[44px]', 'pointer-coarse:opacity-100', 'opacity-0']),
96+
fieldListPencil: g('section', /const FIELD_LIST_PENCIL_CLASS = '([^']+)'/, ['sr-only', 'focus-visible:not-sr-only']),
9097
stripPencil: g('strip', /className="([^"]+)"\s*aria-label=\{t\('detail\.editInlineHint'\)\}/, ['min-h-[44px]', 'pointer-coarse:opacity-100', 'opacity-0']),
9198
saveCancel: g('saveBar', /disabled=\{inline\.saving\}\s*className="([^"]+)"/, ['h-11', 'sm:h-9']),
9299
saveSave: g('saveBar', /disabled=\{inline\.saving \|\| locked\}\s*className="([^"]+)"/, ['h-11', 'sm:h-9']),
@@ -262,6 +269,20 @@ test.describe('the record flow at phone width (objectstack#29071)', () => {
262269
});
263270
}
264271

272+
test('on the field list a phone taps the value: its pencil takes no room and is no target until focused (objectstack#36147)', async ({ browser }) => {
273+
const page = await open(browser, 375, 812, true);
274+
await measure(page, `<div class="group flex items-start justify-between gap-2"><div class="text-sm flex-1 min-w-0 py-1">Acme Corp</div><button type="button" class="${CLS.buttonBase} ${CLS.fieldListPencil}" id="list-pencil"><svg width="12" height="12"></svg></button></div>`);
275+
const before = await page.evaluate(() => document.getElementById('list-pencil')!.getBoundingClientRect());
276+
expect(before.width).toBeLessThanOrEqual(1);
277+
expect(before.height).toBeLessThanOrEqual(1);
278+
// The keyboard's way in: focused, it is drawn at its own size.
279+
// A keyboard focus (Tab), so `:focus-visible` holds.
280+
await page.keyboard.press('Tab');
281+
const focused = await page.evaluate(() => document.getElementById('list-pencil')!.getBoundingClientRect());
282+
expect(focused.width).toBeGreaterThan(1);
283+
await page.context().close();
284+
});
285+
265286
test('above `sm`, with a mouse, the controls keep their desktop size and the pencil waits for hover', async ({ browser }) => {
266287
const page = await open(browser, 1280, 800, false);
267288
const r = await measure(page, fixture());

‎ui/packages/app-shell/src/views/RecordDetailView.harness.test.tsx‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,7 +3029,9 @@ describe('RecordDetailView.recordEditState-35599', () => {
30293029

30303030
const headerButton = (label: string) =>
30313031
(Array.from(document.querySelectorAll('button')).find((b) => (b.textContent ?? '').trim() === label) as HTMLButtonElement | undefined) ?? null;
3032-
const pencils = (container: HTMLElement) => container.querySelectorAll('button[aria-label="Double-click to edit"]').length;
3032+
// The field list's pencil is named for a click (objectstack#36147), every other face's for a double-click.
3033+
const pencils = (container: HTMLElement) =>
3034+
container.querySelectorAll('button[aria-label="Double-click to edit"], button[aria-label="Click to edit"]').length;
30333035
const editor = (container: HTMLElement, id: string) => container.querySelector(`[data-body-table-editor="${id}"]`) as HTMLElement | null;
30343036
const cells = (scope: HTMLElement, label: string) => Array.from(scope.querySelectorAll(`input[aria-label="${label}"]`)) as HTMLInputElement[];
30353037
const summaryInput = (container: HTMLElement) =>
@@ -3058,9 +3060,13 @@ describe('RecordDetailView.recordEditState-35599', () => {
30583060
fireEvent.change(cells(tasks, 'Subject')[0], { target: { value: 'Visit' } });
30593061
}
30603062

3061-
/** The pencil of the Summary field (the inline-edit entry), on the details column. */
3063+
/**
3064+
* The pencil of the Summary field (the inline-edit entry), on the details
3065+
* column: the keyboard's way in on the field list, named for a click
3066+
* (objectstack#36147).
3067+
*/
30623068
const summaryPencil = (container: HTMLElement) =>
3063-
(Array.from(container.querySelectorAll('[data-record-column="details"] button[aria-label="Double-click to edit"]')) as HTMLElement[])
3069+
(Array.from(container.querySelectorAll('[data-record-column="details"] button[aria-label="Click to edit"]')) as HTMLElement[])
30643070
.find((b) => (b.closest('.group')?.textContent ?? '').includes('Summary')) ?? null;
30653071
const saveBar = () => document.querySelector('[role="region"][aria-label="Edit fields"]') as HTMLElement | null;
30663072
const detailInputValues = (container: HTMLElement) =>

‎ui/packages/app-shell/src/views/RecordDetailView.phoneOwnerLine-28909.test.tsx‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@
2828
* body draws the owner (the meta line does not), and an object whose body
2929
* draws no `owner_id` (the field is `hidden`) keeps the owner on the meta
3030
* line.
31+
*
32+
* On the laid-out page the meta line is the details column's last group,
33+
* 「系统信息」 (objectstack#36147), folded until opened: the owner and the
34+
* record ID it keeps are that group's rows, read here with the group opened.
3135
*/
3236

3337
import * as React from 'react';
3438
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
35-
import { render, cleanup, waitFor } from '@testing-library/react';
39+
import { render, cleanup, waitFor, fireEvent, within } from '@testing-library/react';
3640
import { MemoryRouter, Route, Routes } from 'react-router-dom';
3741
import { MetadataCtx } from '@object-ui/react';
3842
import { RelatedCountStore } from '@object-ui/components';
@@ -172,7 +176,17 @@ async function metaLineLoaded(): Promise<HTMLElement> {
172176
);
173177
}
174178

175-
const ownerEntry = (metaLine: HTMLElement) => metaLine.querySelector('[data-record-meta-owner]');
179+
/** Open the 「系统信息」 group the meta line is on the laid-out page (objectstack#36147). */
180+
function openSystemInfo(metaLine: HTMLElement) {
181+
const toggle = within(metaLine).getByRole('button', { name: 'System information' });
182+
if (toggle.getAttribute('aria-expanded') !== 'true') fireEvent.click(toggle);
183+
}
184+
/** The value of the system group's row labelled `label`, or `null`. */
185+
const systemRow = (metaLine: HTMLElement, label: string) => {
186+
const el = Array.from(metaLine.querySelectorAll('[data-detail-field-label]')).find((l) => l.textContent === label);
187+
return (el?.closest('[data-detail-field-row]') as HTMLElement | null) ?? null;
188+
};
189+
const ownerEntry = (metaLine: HTMLElement) => systemRow(metaLine, 'Owner');
176190
/** How many times the owner's name is painted on the whole page. */
177191
const ownerCount = () => document.body.textContent!.split('Ada Admin').length - 1;
178192

@@ -214,11 +228,12 @@ describe('the owner at every width, once (objectstack#28909)', () => {
214228
mountPage();
215229
const metaLine = await metaLineLoaded();
216230
expect(document.querySelector('[data-highlights-face]')).toBeNull();
231+
openSystemInfo(metaLine);
217232
await waitFor(() => expect(ownerCount()).toBe(1));
218233
expect(ownerEntry(metaLine)).toBeNull();
219234
expect(metaLine.textContent).not.toContain('Ada Admin');
220235
// The rest of the meta line is still drawn.
221-
expect(metaLine.querySelector('[data-record-meta-id]')!.textContent).toBe('r-1');
236+
expect(systemRow(metaLine, 'Record ID')!.textContent).toContain('r-1');
222237
});
223238

224239
it.each([
@@ -229,11 +244,16 @@ describe('the owner at every width, once (objectstack#28909)', () => {
229244
mountPage(OBJECTS_OWNER_HIDDEN);
230245
const metaLine = await metaLineLoaded();
231246
expect(document.querySelector('[data-highlights-face]')).toBeNull();
232-
const owner = ownerEntry(metaLine);
247+
openSystemInfo(metaLine);
248+
const owner = await waitFor(() => {
249+
const row = ownerEntry(metaLine);
250+
expect(row?.textContent).toContain('Ada Admin');
251+
return row;
252+
});
233253
expect(owner).toBeTruthy();
234254
expect(owner!.textContent).toContain('Ada Admin');
235255
expect(ownerCount()).toBe(1);
236256
// The rest of the meta line is still drawn.
237-
expect(metaLine.querySelector('[data-record-meta-id]')!.textContent).toBe('r-1');
257+
expect(systemRow(metaLine, 'Record ID')!.textContent).toContain('r-1');
238258
});
239259
});

0 commit comments

Comments
 (0)