Skip to content

Commit 592845b

Browse files
feat(studio): Restore package original moves onto the override mark, in a popover that names what it overrides and its version (#29842)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbPFUgboizUXWX8RQ7py6Pfk)_ Fixes #29692 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:Studio 里「覆盖 XX」标记变成按钮,点开小气泡:写明覆盖了哪个包、基于哪个版本,底部是「恢复包原版」,仍走原来的确认框。各条目 ⋯ 菜单里的「恢复包原版」去掉,只剩这一个入口;「自定义」保留标题行主按钮位。 - **为什么改**:ADR-0146 D2 要求恢复入口放在点名定制的地方;原来要在 ⋯ 菜单里找,且标记本身不说明基于哪个版本。 - **风险与回滚**:只动 app-shell 前端;恢复请求与原来逐字节相同(先删草稿,再删行,都带 `package=` 配对包),无元数据、接口和 i18n 键变化。回滚即 revert 本 PR。 - **先看**:`StudioCustomizeControls.tsx`(`StudioOverrideChip` 气泡)、`StudioItemHeader.tsx`(折进 ⋯ 菜单后,恢复时关掉菜单)、`StudioDesignSurface.tsx` / `StudioBundleItemEditor.tsx`(去掉菜单项、接上 `onRestore`)。 - **两分钟验证**:窗口 1024 px、右侧面板打开,在 Studio 打开一个已定制的视图:⋯ → 点「覆盖 …」→ 气泡里有版本句和「恢复包原版」→ 弹出确认框,菜单已关。键盘:⋯ 上 Enter,再 Enter 打开气泡,焦点在「恢复包原版」。 - **需要你做的**:无,席位落地。 ## What changes - **The override mark is the door.** `StudioOverrideChip` ("Overrides HotCRM") is now a popover trigger. The popover (`studio-override-popover`) names the package it overrides and the version it was taken from (the existing `overridesTitle` sentence, which was the chip's tooltip), and holds **Restore package original** (`studio-override-restore`). Restore goes through the existing confirmation dialog, and confirming sends the same two deletes at the pair as before: its draft, then its row. Without `onRestore` (a declaration served while the item is not in the pair) the popover shows the facts only. - **Every type that draws the mark gets it:** Interfaces views, dashboards and reports (the item header), an object leaf's list view, flows (Automations), and the All-metadata form editor (`StudioBundleItemEditor`). Customize keeps the header's primary slot; Restore is never a header button of its own. - **One door.** The ⋯-menu Restore entries (`studio-restore-original`) come out of the Interfaces item menu, `FlowItemMoreMenu` (its `restore` prop is gone) and the bundle editor's menu. Each host's `inPair` is `declaration !== null`, so everywhere Restore was reachable the mark is drawn and carries it. - **Folded into the ⋯ menu** (#29693's header fold): the mark sits in the one `studio-item-header-folded-chips` entry. Its popover is a child of that menu item in React's tree, so pointer, click and key events inside it stop at the popover. Otherwise a pointer moving over the popover focused the menu item and closed the popover. Restore there closes the ⋯ menu before the confirmation opens (`useStudioFoldedMenuClose`), so no hidden menu is left behind the dialog to take the next Enter. - `content/docs/build-without-code.mdx`: the sentence that sent the reader to the ⋯ menu now points at the mark. - No new i18n keys and no changed en values. ## Tests - `StudioCustomizeControls.customize-28562.test.tsx`: the chip's facts are on the popover; Restore asks once and closes; a disabled Restore asks nothing; without `onRestore` the popover is facts only. - `StudioItemHeader.titleRowFold-12897.test.tsx`, new describe for the folded mark: one press opens one popover and the menu stays, a second press closes it; Enter on the folded entry opens it; Restore asks once and closes both the popover and the menu; a pointer moving and pressing inside the popover neither focuses the entry nor closes the popover. - `InterfacesPillar.customize-28562.test.tsx`, `AutomationsPillar.customizeFlow-28570.test.tsx`, `StudioBundleItemEditor.customize-28569.test.tsx`: Restore is driven from the mark and the existing `resets` assertions (same two requests at the pair) still hold; the ⋯ menus carry no `studio-restore-original`; the dialog's item label equals the rail row's label (Interfaces "Pipeline", flow "Notify owner"). - `ui/e2e/live/studio-customize-journey.spec.ts`: the Restore step presses the mark in the row, or in the folded ⋯ entry when the row has folded, then the popover's Restore. <details><summary>Readings</summary> - At head 9403cae: the five touched test files plus `itemTools-28239` and `oneSurface-28572`, 7 files, 112 tests passed. - Ablation of the two folded-menu fixes, one at a time, restored to the committed blob: dropping the popover's event stops reds the pointer pin (1 failed, 20 passed); dropping the menu close reds the Restore pin (1 failed, 20 passed). - app-shell `type-check` (src and tests) exit 0; `type-check:e2e` exit 0; eslint on the touched files 0 errors. - `pnpm --dir ui exec vitest run scripts/`: 170 files passed, 2 skipped. `check:type-check-debt` exit 0. `check-i18n-en-drift`: no en value changed. - Derived gates (`dispatch-gates --commands`): 67 derived, 67 run, all exit 0; `--ran` reconciles 0 NOT-MEASURED. `check-sdui-manifest` exit 0. - Merged `main` right before opening (14 incoming commits, none touching these files; no parallel fix found). </details> ## Acceptance notes - Dialog label (任务清单 vs "Task List"): not reproducible on this tree. In zh the view leaf's dialog says 「任务清单」, as its header and rail row do; in en it says "Task List". The dashboard reads 「图表画廊」, the object leaf's list view 「全部任务」, and the flow "Notify on Task Completed", matching its zh rail row (the flow has no translation). Pinned in tests against the rail label. - At about 1024 px with the right panel open every header folds, so the folded state was measured there and the row state at 1440 px with the panel open (object leaf list view). - The live journey spec passes with `--timeout=180000` (41.6 s); under the default 30 s test timeout it runs out in the later "Add region__c" step on a Vite dev Console, after Restore has passed. ## Verification Live on the showcase app (`objectstack dev --seed-admin --fresh`) with the Console on Vite, Chromium, right panel open, overrides drafted in the pair for a view, a dashboard, a flow and an object's list view. For each, by mouse and by keyboard, at 1024 px (folded) and 1440 px: | Item | Header | Mouse | Keyboard | |---|---|---|---| | View (Task List) | folded at 1024 and 1440 | popover stays open under the pointer, exactly one, menu stays under it; Restore opens the dialog and the menu is gone | Enter on ⋯ focuses the folded entry, Enter opens the popover with focus on Restore, Enter opens the dialog | | Dashboard (Chart Gallery) | folded at 1024 and 1440 | same | same | | Flow (Notify on Task Completed) | folded at 1024 and 1440 | same | same | | Object list view (All Tasks) | folded at 1024, row at 1440 | same | same | Screenshots (en and zh) are with the seat. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jUNJci3hxdpiN6RFQ1 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent eb833b5 commit 592845b

13 files changed

Lines changed: 399 additions & 109 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
feat(app-shell): Studio's override mark opens a popover that names the customization and offers Restore package original
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
In Studio, the mark on an item customized into the base's pair ("Overrides HotCRM") used to tell you nothing more, and you had to find "Restore package original" in the item's ⋯ menu. The mark is now a button. Pressing it opens a small popover that says which package the item overrides and which version of it the customization was taken from, with a "Restore package original" button. That button asks through the same confirmation dialog as before, and confirming sends the same two deletes at the pair: its draft, then its row. Customize keeps the header's primary slot, and Restore is never a header button of its own. The ⋯ menus of the Interfaces item, the flow and the All-metadata form editor no longer list Restore, so the mark is the one place to find it. On a narrow header, where the mark folds into the ⋯ menu, it opens the same popover there. Choosing the folded entry with the keyboard opens it too. The popover stays open while the pointer moves over it, and Restore there closes the ⋯ menu before the confirmation opens.

‎content/docs/build-without-code.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Two properties make Studio safe to hand to non-developers:
3535

3636
## Setup — where the platform is administered
3737

38-
The **System Settings** app covers platform administration: user management and invitations, permission assignment, datasources (including federated external databases), diagnostics and audit logs, and the **Marketplace** — template apps such as HotCRM install with one click and appear alongside your own apps. Setup holds no metadata editor: its metadata pages open Studio, and an installed app is customized there. Open the app in Studio and every change lands in its paired customization package (`hotcrm.custom` for HotCRM), created on your first change and exported and deployed like any package, while what shipped stays the vendor's. **Customize** on a view, dashboard, report or flow saves your version as an override of the shipped one, marked with the app it overrides, and **Restore package original** removes it. **Add field** on a shipped object adds your own field, named with a `__c` suffix, and a shipped field's label, description, help text, placeholder and option labels can be changed, nothing else. A shipped flow's switch turns it off for this deployment, and **New similar** copies a flow or a permission set under a new name; a flow's copy starts switched off.
38+
The **System Settings** app covers platform administration: user management and invitations, permission assignment, datasources (including federated external databases), diagnostics and audit logs, and the **Marketplace** — template apps such as HotCRM install with one click and appear alongside your own apps. Setup holds no metadata editor: its metadata pages open Studio, and an installed app is customized there. Open the app in Studio and every change lands in its paired customization package (`hotcrm.custom` for HotCRM), created on your first change and exported and deployed like any package, while what shipped stays the vendor's. **Customize** on a view, dashboard, report or flow saves your version as an override of the shipped one, marked with the app it overrides. Press that mark to see which version it was taken from, and **Restore package original** there removes it. **Add field** on a shipped object adds your own field, named with a `__c` suffix, and a shipped field's label, description, help text, placeholder and option labels can be changed, nothing else. A shipped flow's switch turns it off for this deployment, and **New similar** copies a flow or a permission set under a new name; a flow's copy starts switched off.
3939

4040
## When to reach for code instead
4141

‎ui/e2e/live/studio-customize-journey.spec.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,16 @@ test('a read-only base is customized, restored and extended through Studio, and
166166
if (r.request().method() === 'DELETE' && r.url().includes(`/api/v1/meta/view/${VIEW}`)) deletes.push(`${r.status()} ${r.url()}`);
167167
};
168168
page.on('response', onResponse);
169-
await page.getByTestId('if-item-more').click();
170-
await page.getByTestId('studio-restore-original').click();
169+
// objectstack#29692 — Restore is on the override chip's popover: the chip in
170+
// the row, or in the item's ⋯ menu while the header is folded.
171+
const rowChip = page.getByTestId('if-item-header').getByTestId('studio-override-chip');
172+
if (await rowChip.isVisible()) {
173+
await rowChip.click();
174+
} else {
175+
await page.getByTestId('if-item-more').click();
176+
await page.getByTestId('studio-item-header-folded-chips').getByTestId('studio-override-chip').click();
177+
}
178+
await page.getByTestId('studio-override-popover').getByTestId('studio-override-restore').click();
171179
await page.getByTestId('studio-restore-original-confirm').click();
172180
await expect(page.getByTestId('studio-customize')).toBeVisible();
173181
await expect.poll(() => deletes.length).toBe(2);

‎ui/packages/app-shell/src/views/studio-design/AutomationsPillar.customizeFlow-28570.test.tsx‎

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ async function openMenu(): Promise<void> {
286286
await screen.findByTestId('auto-item-new-similar');
287287
}
288288

289+
/**
290+
* objectstack#29692 — Restore is asked from the override mark's popover, and
291+
* confirmed in the same dialog the flow's menu opened before.
292+
*/
293+
async function openRestorePopover(): Promise<HTMLElement> {
294+
fireEvent.click(await within(header()).findByTestId('studio-override-chip', undefined, { timeout: 8000 }));
295+
return screen.findByTestId('studio-override-popover');
296+
}
297+
289298
/** The one switch drawn in the header is the ledger's: no definition switch beside it. */
290299
async function expectLedgerSwitchAlone(): Promise<void> {
291300
const ledger = await within(header()).findByTestId('auto-ledger-switch', undefined, { timeout: 8000 });
@@ -335,7 +344,13 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
335344
// The badge reads the declaration the pair's draft now serves.
336345
const chip = await within(header()).findByTestId('studio-override-chip', undefined, { timeout: 8000 });
337346
expect(chip).toHaveTextContent(tFormat('engine.studio.customize.overrides', 'en', { package: 'HotCRM' }));
338-
expect(chip).toHaveAttribute('title', tFormat('engine.studio.customize.overridesTitle', 'en', { package: 'HotCRM', basedOn: '4.0.0' }));
347+
// objectstack#29692 — pressed, the mark says the version it was taken from.
348+
fireEvent.click(chip);
349+
expect(await screen.findByTestId('studio-override-popover-facts')).toHaveTextContent(
350+
tFormat('engine.studio.customize.overridesTitle', 'en', { package: 'HotCRM', basedOn: '4.0.0' }),
351+
);
352+
fireEvent.keyDown(document.activeElement ?? document.body, { key: 'Escape' });
353+
await waitFor(() => expect(screen.queryByTestId('studio-override-popover')).toBeNull());
339354
await expectLedgerSwitchAlone();
340355

341356
// A later edit asks the door no more, and is pinned to the version it was answered.
@@ -358,10 +373,14 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
358373
await expectLedgerSwitchAlone();
359374

360375
// The layered envelope says `deletable: false`; the declared row decides.
376+
const popover = await openRestorePopover();
377+
expect(within(popover).getByTestId('studio-override-restore')).toBeEnabled();
378+
fireEvent.keyDown(document.activeElement ?? document.body, { key: 'Escape' });
379+
await waitFor(() => expect(screen.queryByTestId('studio-override-popover')).toBeNull());
380+
// Delete flow stays a writable package's own; Restore is the mark's, not the menu's (objectstack#29692).
361381
await openMenu();
362-
expect(screen.getByTestId('studio-restore-original')).not.toHaveAttribute('data-disabled');
363-
// Delete flow stays a writable package's own.
364382
expect(screen.queryByTestId('auto-item-delete')).toBeNull();
383+
expect(screen.queryByTestId('studio-restore-original')).toBeNull();
365384

366385
// Its editors are open: an edit is saved into the pair, keeping the declaration.
367386
fireEvent.keyDown(document.activeElement ?? document.body, { key: 'Escape' });
@@ -379,10 +398,16 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
379398
mount({ listedPair: PAIR });
380399
await openFlow(/^Notify owner and manager v2$/);
381400

382-
await openMenu();
383-
fireEvent.click(screen.getByTestId('studio-restore-original'));
401+
// objectstack#29692 — the dialog names the flow as its rail row does.
402+
const railText = within(screen.getByTestId('studio-rail-automations'))
403+
.getByRole('button', { name: /^Notify owner/ })
404+
// The row's label, without the switch reading the row prints after it.
405+
.querySelector('.flex-1')
406+
?.textContent?.trim();
407+
expect(railText).toBe('Notify owner');
408+
fireEvent.click(within(await openRestorePopover()).getByTestId('studio-override-restore'));
384409
const dialog = await screen.findByTestId('studio-restore-original-dialog');
385-
const vars = { item: 'Notify owner', package: 'HotCRM' };
410+
const vars = { item: railText!, package: 'HotCRM' };
386411
expect(dialog).toHaveTextContent(tFormat('engine.studio.customize.restoreConfirm', 'en', vars));
387412
expect(dialog).toHaveTextContent(tFormat('engine.studio.customize.restoreFlowBody', 'en', vars));
388413
expect(dialog).toHaveTextContent(t('engine.studio.customize.restoreDraft', 'en'));

‎ui/packages/app-shell/src/views/studio-design/FlowItemMoreMenu.tsx‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
* `type/name` (objectui#13333). The pillar sends the delete itself. Reset
2121
* overlay is not offered: it arrives with the overlay editing of the
2222
* Studio / Setup boundary record's phase 2 (#28045).
23-
* - **Restore package original** (objectstack#28570, ADR-0146 D2), a
24-
* read-only base's flow that its pair overrides. The pillar decides it from
25-
* the served declaration and holds the confirmation, outside this menu.
23+
*
24+
* Restore package original is not here: it is on the flow's override mark,
25+
* where the customization is named (objectstack#29692).
2626
*/
2727

2828
import * as React from 'react';
@@ -56,7 +56,6 @@ import { t, tFormat, translateMetadataType } from '../metadata-admin/i18n.js';
5656
import { envelopeData, envelopeRefused } from '../setup/packagedFlows.js';
5757
import { apiBase } from '../../utils/apiBase.js';
5858
import { STUDIO_HEADER_ICON_BUTTON } from './studio-tokens.js';
59-
import { StudioRestoreOriginalItem } from './StudioCustomizeControls.js';
6059

6160
/** What the clone door saved: the copy's name, the package it names, and its sentence. */
6261
export interface FlowCopied {
@@ -145,17 +144,15 @@ interface NewSimilarDraft {
145144
/**
146145
* `label` is the flow's display label; `disabled` holds the menu's actions
147146
* while a save is in flight. `onDelete` draws Delete flow (a writable
148-
* package's flow); `newSimilar` draws New similar; `restore` draws Restore
149-
* package original (a flow the base's pair overrides).
147+
* package's flow); `newSimilar` draws New similar.
150148
*/
151-
export function FlowItemMoreMenu({ name, label, locale, disabled, onDelete, newSimilar, restore }: {
149+
export function FlowItemMoreMenu({ name, label, locale, disabled, onDelete, newSimilar }: {
152150
name: string;
153151
label: string;
154152
locale: string;
155153
disabled?: boolean;
156154
onDelete?: () => void;
157155
newSimilar?: FlowNewSimilarProps;
158-
restore?: { disabled?: boolean; onSelect: () => void };
159156
}): React.ReactElement {
160157
const [confirming, setConfirming] = React.useState(false);
161158
const [copy, setCopy] = React.useState<NewSimilarDraft | null>(null);
@@ -234,9 +231,6 @@ export function FlowItemMoreMenu({ name, label, locale, disabled, onDelete, newS
234231
{t('engine.studio.auto.deleteFlow', locale)}
235232
</DropdownMenuItem>
236233
)}
237-
{restore && (
238-
<StudioRestoreOriginalItem disabled={disabled || restore.disabled} locale={locale} onSelect={restore.onSelect} />
239-
)}
240234
</DropdownMenuContent>
241235
</DropdownMenu>
242236
{onDelete && (

‎ui/packages/app-shell/src/views/studio-design/InterfacesPillar.customize-28562.test.tsx‎

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,20 @@ async function customize(): Promise<void> {
307307
await waitFor(() => expect(within(header()).queryByTestId('studio-customize')).toBeNull());
308308
}
309309

310+
/**
311+
* objectstack#29692 — Restore is asked from the override mark's popover, and
312+
* confirmed in the same dialog the item menu opened before.
313+
*/
314+
async function openRestoreDialog(): Promise<HTMLElement> {
315+
fireEvent.click(await within(header()).findByTestId('studio-override-chip', undefined, { timeout: 8000 }));
316+
const popover = await screen.findByTestId('studio-override-popover');
317+
await waitFor(() => expect(within(popover).getByTestId('studio-override-restore')).toBeEnabled(), { timeout: 8000 });
318+
fireEvent.click(within(popover).getByTestId('studio-override-restore'));
319+
return screen.findByTestId('studio-restore-original-dialog');
320+
}
321+
310322
async function restore(): Promise<void> {
311-
fireEvent.pointerDown(await screen.findByTestId('if-item-more', undefined, { timeout: 8000 }), { button: 0, ctrlKey: false });
312-
fireEvent.click(await screen.findByTestId('studio-restore-original'));
313-
const dialog = await screen.findByTestId('studio-restore-original-dialog');
314-
fireEvent.click(within(dialog).getByTestId('studio-restore-original-confirm'));
323+
fireEvent.click(within(await openRestoreDialog()).getByTestId('studio-restore-original-confirm'));
315324
}
316325

317326
describe('Customize a read-only base’s dashboard into its pair (objectstack#28562)', () => {
@@ -351,7 +360,13 @@ describe('Customize a read-only base’s dashboard into its pair (objectstack#28
351360
// The badge reads the declaration the pair's draft now serves.
352361
const chip = await within(header()).findByTestId('studio-override-chip', undefined, { timeout: 8000 });
353362
expect(chip).toHaveTextContent(tFormat('engine.studio.customize.overrides', 'en', { package: 'HotCRM' }));
354-
expect(chip).toHaveAttribute('title', tFormat('engine.studio.customize.overridesTitle', 'en', { package: 'HotCRM', basedOn: '4.0.0' }));
363+
// objectstack#29692 — pressed, the mark says the version it was taken from.
364+
fireEvent.click(chip);
365+
expect(await screen.findByTestId('studio-override-popover-facts')).toHaveTextContent(
366+
tFormat('engine.studio.customize.overridesTitle', 'en', { package: 'HotCRM', basedOn: '4.0.0' }),
367+
);
368+
fireEvent.keyDown(document.activeElement ?? document.body, { key: 'Escape' });
369+
await waitFor(() => expect(screen.queryByTestId('studio-override-popover')).toBeNull());
355370

356371
// A later edit of the same item asks the door no more.
357372
patchBoard();
@@ -480,13 +495,37 @@ describe('Restore package original (objectstack#28562)', () => {
480495
overrides: { package: BASE, basedOn: '4.0.0' },
481496
});
482497
mount({ listedPair: PAIR });
483-
await within(header()).findByTestId('studio-override-chip', undefined, { timeout: 8000 });
484-
fireEvent.pointerDown(screen.getByTestId('if-item-more'), { button: 0, ctrlKey: false });
485-
fireEvent.click(await screen.findByTestId('studio-restore-original'));
486-
fireEvent.click(within(await screen.findByTestId('studio-restore-original-dialog')).getByTestId('studio-restore-original-cancel'));
498+
fireEvent.click(within(await openRestoreDialog()).getByTestId('studio-restore-original-cancel'));
487499
await sleep(300);
488500
expect(srv.resets).toEqual([]);
489501
});
502+
503+
it('objectstack#29692 — one door: the item’s ⋯ menu offers no Restore, and the dialog names the item as its rail row does', async () => {
504+
srv.pairExists = true;
505+
srv.pairActive.set('dashboard/pipeline', {
506+
name: 'pipeline',
507+
label: 'Pipeline (ours)',
508+
widgets: [],
509+
overrides: { package: BASE, basedOn: '4.0.0' },
510+
});
511+
mount({ listedPair: PAIR });
512+
await within(header()).findByTestId('studio-override-chip', undefined, { timeout: 8000 });
513+
fireEvent.pointerDown(screen.getByTestId('if-item-more'), { button: 0, ctrlKey: false });
514+
await screen.findByTestId('if-item-view-definition');
515+
expect(screen.queryByTestId('studio-restore-original')).toBeNull();
516+
fireEvent.keyDown(screen.getByTestId('if-item-view-definition'), { key: 'Escape' });
517+
await waitFor(() => expect(screen.queryByTestId('if-item-view-definition')).toBeNull());
518+
519+
const railRow = within(screen.getByTestId('studio-rail-interfaces')).getByRole('button', { name: /Pipeline/ });
520+
// The row's label, without the kind word the row prints after it.
521+
const railText = railRow.querySelector('.flex-1')?.textContent?.trim() ?? '';
522+
expect(railText).toBe('Pipeline');
523+
const dialog = await openRestoreDialog();
524+
expect(within(dialog).getByRole('heading')).toHaveTextContent(
525+
tFormat('engine.studio.customize.restoreConfirm', 'en', { package: 'HotCRM', item: railText }),
526+
);
527+
fireEvent.click(within(dialog).getByTestId('studio-restore-original-cancel'));
528+
});
490529
});
491530

492531
/** The calendar setting `key` of the list-view panel. */

‎ui/packages/app-shell/src/views/studio-design/StudioBundleItemEditor.customize-28569.test.tsx‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,12 @@ async function customize(): Promise<void> {
253253
await waitFor(() => expect(screen.queryByTestId('studio-customize')).toBeNull());
254254
}
255255

256+
/** objectstack#29692 — Restore is asked from the override mark's popover. */
256257
async function restore(): Promise<void> {
257-
fireEvent.pointerDown(await screen.findByTestId('studio-bundle-editor-more'), { button: 0, ctrlKey: false });
258-
fireEvent.click(await screen.findByTestId('studio-restore-original'));
258+
fireEvent.click(await screen.findByTestId('studio-override-chip', undefined, { timeout: 8000 }));
259+
const popover = await screen.findByTestId('studio-override-popover');
260+
await waitFor(() => expect(within(popover).getByTestId('studio-override-restore')).toBeEnabled(), { timeout: 8000 });
261+
fireEvent.click(within(popover).getByTestId('studio-override-restore'));
259262
const dialog = await screen.findByTestId('studio-restore-original-dialog');
260263
fireEvent.click(within(dialog).getByTestId('studio-restore-original-confirm'));
261264
}
@@ -371,6 +374,12 @@ describe('Customize a read-only base’s email template, one locale (objectstack
371374
mount({ type: 'email_template', name: 'welcome', member: 'zh-CN', listedPair: PAIR });
372375
expect(await field('Subject')).toHaveValue('欢迎回来');
373376
expect(await screen.findByTestId('studio-override-chip')).toBeInTheDocument();
377+
// objectstack#29692 — one door: the editor's ⋯ menu offers no Restore.
378+
fireEvent.pointerDown(screen.getByTestId('studio-bundle-editor-more'), { button: 0, ctrlKey: false });
379+
await screen.findByTestId('studio-bundle-editor-history');
380+
expect(screen.queryByTestId('studio-restore-original')).toBeNull();
381+
fireEvent.keyDown(screen.getByTestId('studio-bundle-editor-history'), { key: 'Escape' });
382+
await waitFor(() => expect(screen.queryByTestId('studio-bundle-editor-history')).toBeNull());
374383

375384
await restore();
376385
await waitFor(() => expect(srv.resets).toHaveLength(2));

0 commit comments

Comments
 (0)