Skip to content

Commit 9de0873

Browse files
committed
test(app-shell): migrate two record-page pins to the page without a strip
The phone face no longer draws a strip under the subtitle, and the 7190 dependsOn pins place the strip through a slotted page's highlights slot, so both InlineFieldInput call sites stay covered. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTcbvQNTSr6ij3TMW7
1 parent 8729f17 commit 9de0873

2 files changed

Lines changed: 31 additions & 23 deletions

File tree

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

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@
4545
*
4646
* `InlineFieldInput` has exactly two non-test call sites — `DetailSection` (the
4747
* details body) and `HeaderHighlight` (the highlights strip). The canonical
48-
* record page routes a field to exactly one of them: `buildDefaultTabs` hands
49-
* the strip's field list to `buildDefaultDetails` as `hideFields`, so a
50-
* highlight is hidden from the body. Declaring `highlightFields` therefore
51-
* selects which call site renders the fields under test, with no classname
52-
* coupling and no double render.
48+
* record page routes a field to exactly one of them: a strip's fields are
49+
* left out of the body (`HighlightFieldsContext`), so the field list the
50+
* strip holds selects which call site renders the fields under test, with no
51+
* classname coupling and no double render. Since objectstack#35891 the default
52+
* page draws no strip, so every case places it through a slotted page's
53+
* `highlights` slot (`stripPage`), holding the list it declares.
5354
*
5455
* The two call sites build the record differently, which is why both are pinned
5556
* rather than one: `DetailView` hands `DetailSection` the saved record already
@@ -241,8 +242,7 @@ function makeDataSource(fields: Fields, record: Record<string, unknown> = RECORD
241242
} as any;
242243
}
243244

244-
function makeMetadata() {
245-
const pages: any[] = [];
245+
function makeMetadata(pages: any[] = []) {
246246
return {
247247
objects: [], pages, loading: false, error: null,
248248
refresh: async () => {}, invalidate: () => {},
@@ -251,10 +251,22 @@ function makeMetadata() {
251251
} as any;
252252
}
253253

254-
function tree(ds: any, objects: any[]) {
254+
/**
255+
* The record page that draws the strip. Since objectstack#35891 the default
256+
* page draws none, so the strip is placed the way an author places it: a
257+
* slotted page whose `highlights` slot holds the declared list.
258+
*/
259+
function stripPage(highlightFields: string[]) {
260+
return {
261+
name: `${OBJECT}_strip`, type: 'record', object: OBJECT, kind: 'slotted', isDefault: true, regions: [],
262+
slots: { highlights: { type: 'record:highlights', properties: { fields: highlightFields } } },
263+
};
264+
}
265+
266+
function tree(ds: any, objects: any[], pages: any[] = []) {
255267
return (
256268
<MemoryRouter initialEntries={[`/app/demo/${OBJECT}/${REC}`]}>
257-
<MetadataCtx.Provider value={makeMetadata()}>
269+
<MetadataCtx.Provider value={makeMetadata(pages)}>
258270
<RecordDetailView
259271
dataSource={ds}
260272
objects={objects}
@@ -279,7 +291,7 @@ async function openInlineEdit(
279291
record: Record<string, unknown> = RECORD,
280292
) {
281293
const ds = makeDataSource(fields, record);
282-
const { container } = render(tree(ds, objectsWith(fields, highlightFields)));
294+
const { container } = render(tree(ds, objectsWith(fields, highlightFields), [stripPage(highlightFields)]));
283295
await screen.findByText('Task one');
284296
fireEvent.doubleClick(screen.getByText('emea'));
285297
await waitFor(() => {

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* knows its rows; no ⊟ (the stack has no right column), no ⤡ (no drawer
1616
* to collapse to);
1717
* - Target 4, the header: the subtitle from the first two declared text
18-
* highlights, then at most four highlights;
18+
* highlights (the strip of four that followed is gone since
19+
* objectstack#35891);
1920
* - Target 7, the bottom bar: the header's actions drawn below the body, in
2021
* their bar face — the host's Edit, the primary and the `⋯`, however many
2122
* actions the page declares (objectstack#34595; this file pinned Edit
@@ -301,7 +302,7 @@ describe('the record page on a phone (objectstack#27058)', () => {
301302
expect(pageBar()!.querySelector('[data-record-top-bar-position]')).toBeNull();
302303
});
303304

304-
it('the header: the subtitle from the first two declared text highlights, then at most four highlights', async () => {
305+
it('the header: the subtitle from the first two declared text highlights; no strip under it (objectstack#35891)', async () => {
305306
mountPage([`/apps/${APP}/${LEAD}/record/r-1`]);
306307
const subtitle = await waitFor(
307308
() => {
@@ -312,17 +313,12 @@ describe('the record page on a phone (objectstack#27058)', () => {
312313
{ timeout: 5000 },
313314
);
314315
expect(subtitle.textContent).toBe('Atlas Construction · Director of Sales');
315-
const strip = document.querySelector('[data-highlights-face]') as HTMLElement;
316-
expect(strip).toBeTruthy();
317-
const text = strip.textContent ?? '';
318-
// Email, Status, Phone, City: four, after the subtitle's two; the fifth
319-
// declared one (Website) is in the sections.
320-
expect(strip.children).toHaveLength(4);
321-
expect(text).toContain('mira@atlas.test');
322-
expect(text).toContain('Austin');
323-
expect(text).not.toContain('Atlas Construction');
324-
expect(text).not.toContain('atlas.test/');
325-
expect(text).not.toContain('https://atlas.test');
316+
// Until objectstack#35891 a strip of four highlights (Email, Status,
317+
// Phone, City) followed. The default page draws no strip now, on a phone
318+
// as on a desktop; those fields read in their groups.
319+
expect(document.querySelector('[data-highlights-face]')).toBeNull();
320+
await waitFor(() => expect(document.body.textContent).toContain('mira@atlas.test'));
321+
expect(document.body.textContent).toContain('Austin');
326322
});
327323

328324
it('the bottom bar: [Edit][Convert Lead][⋯] with the declared second action in the ⋯; the header draws no action row (objectstack#34595)', async () => {

0 commit comments

Comments
 (0)