Skip to content

Commit e1a2904

Browse files
committed
test(studio): the area mounts the object designer on its address; review keeps the generic page
Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude <noreply@anthropic.com>
1 parent dd7e129 commit e1a2904

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

‎ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ vi.mock('./StudioBundleItemEditor.js', () => ({
6565
/** `GET /api/v1/packages` as the listed manifests read it: one writable, one read-only, one kernel. */
6666
let listed: Map<string, { id: string; name: string; writable: boolean; manifest: Record<string, unknown> }>;
6767
let listFails = false;
68+
// objectstack#36904 — the object designer, stubbed: only where the area mounts it is under test.
69+
vi.mock('./DataPillar.js', () => ({
70+
DataPillar: (props: { packageId: string; objectName: string; readOnly?: boolean }) => (
71+
<div data-testid="object-designer" data-package={props.packageId} data-object={props.objectName} data-readonly={String(!!props.readOnly)} />
72+
),
73+
}));
6874
vi.mock('./packages-io.js', async (importOriginal) => ({
6975
...(await importOriginal<Record<string, unknown>>()),
7076
fetchListedPackageManifests: vi.fn(async () => {
@@ -285,7 +291,6 @@ describe("a read-only base's create opens in its .custom pair (objectstack#36897
285291

286292
describe('a pillar type opened from the area opens its pillar', () => {
287293
for (const [type, pillar] of [
288-
['object', 'data'],
289294
['flow', 'automations'],
290295
['permission', 'access'],
291296
] as const) {
@@ -298,6 +303,22 @@ describe('a pillar type opened from the area opens its pillar', () => {
298303
});
299304
}
300305

306+
// objectstack#36904 — an object opens its designer on its own address.
307+
it('an object opens the object designer on its own address, bound to the package', async () => {
308+
mount(`/studio/${WRITABLE}/metadata/object/item_1?package=${WRITABLE}`);
309+
const designer = await screen.findByTestId('object-designer');
310+
expect(designer).toHaveAttribute('data-package', WRITABLE);
311+
expect(designer).toHaveAttribute('data-object', 'item_1');
312+
expect(designer).toHaveAttribute('data-readonly', 'false');
313+
expect(new URL(where(), 'http://x').pathname).toBe(`/studio/${WRITABLE}/metadata/object/item_1`);
314+
});
315+
316+
it('CONTROL: an object under `?review=1` keeps the generic page and its draft review', async () => {
317+
mount(`/studio/${WRITABLE}/metadata/object/item_1?package=${WRITABLE}&review=1`);
318+
expect((await page()).page).toBe('item');
319+
expect(screen.queryByTestId('object-designer')).toBeNull();
320+
});
321+
301322
it('a type no pillar designs opens the generic page', async () => {
302323
mount(`/studio/${WRITABLE}/metadata/agent/support_bot?package=${WRITABLE}`);
303324
expect((await page()).page).toBe('item');

0 commit comments

Comments
 (0)