Skip to content

Commit 40ddad6

Browse files
committed
test(studio): the field-groups pins press Save
Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb Co-authored-by: Claude <noreply@anthropic.com>
1 parent b6f217c commit 40ddad6

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*
1616
* Pinned:
1717
* - an object with a default internal form view: the field groups are the
18-
* canvas, the chip says so, Add group saves the object's `fieldGroups` and
19-
* writes no view; Preview shows the field groups, not the view's sections;
18+
* canvas, the chip says so, Add group then the top bar's Save
19+
* (objectstack#36511) saves the object's `fieldGroups` and writes no view; Preview shows the field groups, not the view's sections;
2020
* - CONTROL: no form view: the same canvas and the same save.
2121
*/
2222

@@ -109,6 +109,7 @@ const mockClient = {
109109
return pending ? { item: pending.served, version: 'v7' } : null;
110110
}),
111111
get: vi.fn(async () => null),
112+
publish: vi.fn(async () => ({})), reset: vi.fn(async () => ({})),
112113
save: vi.fn(async () => ({ ok: true, version: 'v2', state: 'draft' })),
113114
};
114115

@@ -140,6 +141,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => {
140141
// warmed here so its first load is paid at import, not inside a test's clock.
141142
import '@objectstack/lint';
142143
import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface';
144+
import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness';
143145
import { t } from '../metadata-admin/i18n';
144146

145147
const FORM = t('engine.studio.data.tab.form', 'en');
@@ -160,9 +162,9 @@ afterEach(() => {
160162

161163
async function openForm(props: { readOnly?: boolean; customization?: StudioBaseCustomization } = {}) {
162164
render(
163-
<MemoryRouter initialEntries={[`/studio/${PKG}/data`]}>
165+
<StudioSaveHarness><MemoryRouter initialEntries={[`/studio/${PKG}/data`]}>
164166
<DataPillar packageId={PKG} {...props} />
165-
</MemoryRouter>,
167+
</MemoryRouter></StudioSaveHarness>,
166168
);
167169
await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 });
168170
await userEvent.click(screen.getAllByRole('button', { name: FORM })[0]);
@@ -186,6 +188,7 @@ describe('the Form tab lays out by field groups, internal form or not (objectsta
186188
expect(screen.queryByTestId('form-layout-flow')).toBeNull();
187189

188190
await userEvent.click(screen.getByTestId('form-designer-add-section-footer'));
191+
await pressStudioSave();
189192
await waitFor(() => expect(saves().length).toBe(1), { timeout: 4000 });
190193
const [type, name, body] = saves()[0];
191194
expect([type, name]).toEqual(['object', OBJECT]);
@@ -219,6 +222,7 @@ describe('the Form tab lays out by field groups, internal form or not (objectsta
219222
expect(screen.getByText(UNGROUPED)).toBeInTheDocument();
220223

221224
await userEvent.click(screen.getByTestId('form-designer-add-section-footer'));
225+
await pressStudioSave();
222226
await waitFor(() => expect(saves().length).toBe(1), { timeout: 4000 });
223227
const [type, name, body] = saves()[0];
224228
expect([type, name]).toEqual(['object', OBJECT]);

0 commit comments

Comments
 (0)