Skip to content

Commit f57ba77

Browse files
committed
test(app-shell): the form-view type pin loads the zh designer strings first; changeset
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXDf4Yt5PtKZFbtLVD
1 parent 8bb293f commit f57ba77

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): Studio Interfaces opens a list view from 不在导航中 on its object's page; the 视图 group lists only what no header dropdown reaches, and names a form view and its own type
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
- **A list view opens on its object's page from every door.** A list view picked under 不在导航中 → 视图, and a link to the view itself (`?surface=view:OBJECT.KEY`, the All metadata door), now land on the object's page with its header dropdown (object / view ▾), on that view: the object's nav entry when it has one, else the object itself, with no entry (`?surface=object:OBJECT`, which a reload or a shared link opens again, `?view=` included). The panel there now also carries what only the view's own page offered: its conditional formatting (条件格式化), whose CEL verdicts hold the view's autosave as they held the view page's Save, and the sections of the spec's authoring form for a view, without the keys the panel already edits. A form view, and a view a read-only base's pair adds, still open as themselves.
12+
- **The 视图 group lists what the dropdowns do not reach.** A list view whose object has a nav entry is no longer listed there, a view only drafted in the package included; the list views of an object with no entry stay listed.
13+
- **Form views read as forms.** A form view is listed by its label, else as the object's name and the word for a form ("Lead form", 「线索表单」), never its item name (`crm_lead.form`); the group's heading says what it holds (表单视图, 视图, or 表单视图与列表视图). In the view inspector, a form view's 视图类型 offers the form layouts of the spec's `FormViewSchema.type` (simple, tabbed, wizard) and reads its own, where it read 「simple(未找到)」; a list view's picker is unchanged.
14+
- **`@object-ui/i18n`: three Studio keys,** `engine.studio.if.offNav.viewForms`, `engine.studio.if.offNav.viewMixed` and `engine.studio.if.offNav.formName`, in en and zh.

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/ViewVariantInspector.formViewType-30046.test.tsx‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import * as React from 'react';
1919
import { describe, it, expect, vi, afterEach } from 'vitest';
20-
import { render, screen, cleanup, fireEvent, waitFor } from '@testing-library/react';
20+
import { render, screen, cleanup, fireEvent, waitFor, within } from '@testing-library/react';
2121

2222
const state = vi.hoisted(() => {
2323
const metadataClient: Record<string, unknown> = {
@@ -35,6 +35,10 @@ vi.mock('../useMetadata', async (importOriginal) => {
3535

3636
import { ViewDefaultInspector } from './ViewInspector';
3737
import { t } from '../i18n';
38+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
39+
40+
// The zh designer strings are a lazy namespace: loaded before any case reads them.
41+
await loadStudioCatalogue('zh');
3842

3943
afterEach(cleanup);
4044

@@ -56,11 +60,20 @@ function renderView(locale: Locale, viewKind: 'form' | 'list', config: Record<st
5660
return screen.getByRole('combobox', { name: t('engine.inspector.view.type', locale) });
5761
}
5862

59-
/** The options the open picker offers, by their text. */
63+
/**
64+
* The options the open picker offers, by their text: read in the listbox this
65+
* trigger controls, so a list another case left in the document is never read.
66+
*/
6067
async function optionsOf(trigger: HTMLElement): Promise<string[]> {
6168
fireEvent.keyDown(trigger, { key: 'ArrowDown' });
62-
await waitFor(() => expect(screen.queryAllByRole('option').length).toBeGreaterThan(0));
63-
return screen.getAllByRole('option').map((o) => (o.textContent ?? '').trim());
69+
const listbox = await waitFor(() => {
70+
const id = trigger.getAttribute('aria-controls');
71+
const el = id ? document.getElementById(id) : null;
72+
expect(el).not.toBeNull();
73+
expect(within(el!).queryAllByRole('option').length).toBeGreaterThan(0);
74+
return el!;
75+
});
76+
return within(listbox).getAllByRole('option').map((o) => (o.textContent ?? '').trim());
6477
}
6578

6679
const formType = (value: string, locale: Locale) => t(`engine.inspector.pageBlock.option.formType.${value}`, locale);

0 commit comments

Comments
 (0)