Skip to content

Commit 5f01741

Browse files
Copilothotlong
andcommitted
fix: address code review - extract HIGHLIGHT_FIELD_NAMES to module level, improve test assertions
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 4bb5e74 commit 5f01741

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,7 @@ All 313 `@object-ui/fields` tests pass.
14681468
- [x] Related list pagination, sorting, filtering
14691469
- [x] Collapsible section groups
14701470
- [x] Header highlight area with key fields
1471+
- [x] Console `RecordDetailView` integration: `autoTabs`, `autoDiscoverRelated`, `highlightFields`, `sectionGroups` wired into `detailSchema` for end-to-end availability
14711472

14721473
---
14731474

apps/console/src/__tests__/RecordDetailEdit.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ describe('RecordDetailView — detail schema features', () => {
185185
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Alice');
186186
});
187187

188-
// The highlightFields should include "Status" and display its value
188+
// The highlightFields should render "Status" label in the highlight banner
189+
// (also appears in the detail section, so multiple matches expected)
190+
const statusElements = screen.getAllByText('Status');
191+
expect(statusElements.length).toBeGreaterThanOrEqual(2); // highlight banner + detail section
192+
// The value "Active" should appear in the highlight area and/or detail section
189193
const activeElements = screen.getAllByText('Active');
190194
expect(activeElements.length).toBeGreaterThanOrEqual(1);
191195
});

apps/console/src/components/RecordDetailView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ interface RecordDetailViewProps {
2525

2626
const FALLBACK_USER = { id: 'current-user', name: 'Demo User' };
2727

28+
/** Field names automatically promoted to the highlight banner when present. */
29+
const HIGHLIGHT_FIELD_NAMES = ['status', 'stage', 'priority', 'category', 'type', 'owner', 'amount'];
30+
2831
export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailViewProps) {
2932
const { objectName, recordId } = useParams();
3033
const { showDebug } = useMetadataInspector();
@@ -258,7 +261,6 @@ export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailVi
258261
);
259262

260263
// Build highlightFields: prefer explicit config, fallback to auto-detect key fields
261-
const HIGHLIGHT_FIELD_NAMES = ['status', 'stage', 'priority', 'category', 'type', 'owner', 'amount'];
262264
const explicitHighlight: HighlightField[] | undefined = objectDef.views?.detail?.highlightFields;
263265
const highlightFields: HighlightField[] = explicitHighlight
264266
?? Object.entries(objectDef.fields || {})

0 commit comments

Comments
 (0)