Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit ae923ec

Browse files
feat(app-shell): the draft status chip sits in one place in every Studio item header (objectui#12524) (#12589)
Fixes #12524 Clause-②: no ## What changed - **Target 1 (one place).** `StudioItemHeader` takes the item's status as data (a new `status` prop: label and an optional tooltip) and draws one shared amber chip, `StudioStatusChip`, right after the identity (the title, then the api-name or kind chips) and before the meta. The identity chips sit in an always-rendered `contents` wrapper (`data-slot="identity-chips"`). It draws no box, so the layout is unchanged, and the chip is the same child of the same title row in Data, Automations, Interfaces and Access. The title stays a direct child of the row, which the objectui#11665 pin reads. - **Target 2 (actions only on the right).** Interfaces' "Unpublished draft" leaves the actions slot. The right slot keeps, in order: the autosaving spinner, the read-only link, Open in Data, Design / Run, and the properties toggle. Data's saved-at meta and Automations' Enabled switch stay at the right. Access's read-only link is an action, so it stays there too (objectui#12453 behaviour unchanged). - **Target 3 (the header places it).** Data, Automations and Interfaces pass `status` with the `engine.studio.unpublishedDraft` text; Access passes its writable "This package's objects · saved as draft" note (`engine.studio.access.banner`, tooltip `engine.studio.access.bannerTitle`). No pillar writes the chip markup any more. No i18n keys added or retired; every existing data-testid stays. ## Decisions and deviations - Slot shape: a typed `status` prop rather than `chips`. The header owns both the chip's position and its look, and the prop refuses markup or a link, so a pillar cannot misplace or restyle it. - Access: the writable note is treated as Access's status (the only draft signal the pillar shows, and the card's measured Access chip). In a read-only package the link stays in actions. Permission sets have no per-set draft status today. - The open-set Access header (the permission matrix page) is unchanged: its note stays at the tab row's right end, where objectui#12456 put it so the set's label is not truncated. That file is outside this change. - The chip now has `shrink-0 whitespace-nowrap`. At 1280 px in the Automations header, main's chip wrapped to two lines (37 px) while the title still truncated; it now stays on one line (21 px). The title truncation exists either way, from that pane's width. - Deviation list against the artboards: no change beyond the above. ## Screenshots (1280 px, a writable package with a draft object, flow, page and app; console at d9376cc against HotCRM 63db83e) - Data: [light](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-data-header-light.png?raw=true) · [dark](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-data-header-dark.png?raw=true) - Automations: [light](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-automations-header-light.png?raw=true) · [dark](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-automations-header-dark.png?raw=true) - Interfaces: [light](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-interfaces-header-light.png?raw=true) · [dark](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-interfaces-header-dark.png?raw=true) · whole window [light](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-interfaces-full-light.png?raw=true) · [dark](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-interfaces-full-dark.png?raw=true) - Access: [light](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-access-header-light.png?raw=true) · [dark](https://github.com/objectstack-ai/objectui/blob/33ef46f53/docs/design/studio-redesign/findings/12524/12524-access-header-dark.png?raw=true) The screenshots live on the never-merged branch `claude/issue-12524-evidence`; this branch carries no PNG. ## Test evidence (head d9376cc) - New: `StudioItemHeader.statusPlace-12524.test.tsx`, 4 passed. It renders the four real pillars with a draft and asserts the chip is a child of the title row at one shared index, after the title and the identity chips, outside the actions. It also asserts the Interfaces actions keep their order with no chip among them. CONTROL: no draft, no chip (Data, Automations, Interfaces); a read-only package, no Access status, and the read-only link in the actions slot. - Ablation: moving the Interfaces chip back into the actions turns 2 of 4 red. After restoring with `git checkout HEAD`, `git diff HEAD` is empty. - Full app-shell suite (the file set of `pnpm --filter @object-ui/app-shell test`), run in 8 shards because of the session's 10-minute command cap: 1420 files passed and 1 skipped; 13538 tests passed and 9 skipped. The existing `StudioDesignSurface.flowCanvasChip-11665` pin is green, unmodified. - `type-check` (source and test configs), `build`, eslint on the touched files (0 errors), `check:i18n-keys`, `check:i18n-drift`, `check-changeset-presence` and `check:new-line-citations`: all exit 0. ## Acceptance notes - Permission sets show no item-level draft status: the Access note says how edits save, not whether this set has a pending draft. Recorded only; not part of this change. Session: `https://claude.ai/code/session_01GzRy6FiHuy1vpBecH2KRYM` --- _Generated by [Claude Code](https://claude.ai/code/session_01GzRy6FiHuy1vpBecH2KRYM)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3eb3ec1 commit ae923ec

4 files changed

Lines changed: 361 additions & 37 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
Studio: the draft status chip sits in the same place in every pillar's item header (objectui#12524). "Unpublished draft" in Data, Automations and Interfaces, and Access's "saved as draft" note, now follow the item's title and its name or kind chip, before the meta line. In Interfaces it no longer sits among the Design / Run actions at the right of the header, which now holds actions only. `StudioItemHeader` draws the chip from a new `status` prop, so a pillar passes the status and no longer places or styles it.

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

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
STUDIO_KIND_CHIP,
4040
} from './studio-tokens.js';
4141
import { StudioInspector } from './StudioInspector.js';
42-
import { StudioItemHeader, StudioTab } from './StudioItemHeader.js';
42+
import { StudioItemHeader, StudioStatusChip, StudioTab, type StudioItemStatus } from './StudioItemHeader.js';
4343
import { overlayPath } from './BuilderLanding.js';
4444
import { DATA_CONTENT_CONTAINER, DATA_TAB_FLAT_ONLY, DATA_TAB_FOLDED_ONLY } from './dataTabsFold.js';
4545
import { StudioRail, StudioRailGroup, StudioRailRow } from './StudioRail.js';
@@ -4017,13 +4017,11 @@ export function InterfacesPillar({
40174017
</span>
40184018
) : undefined
40194019
}
4020+
// objectui#12524 — the draft status sits after the kind chip, as in
4021+
// every pillar; the right slot holds actions only.
4022+
status={hasDraft && draftLoaded ? { label: t('engine.studio.unpublishedDraft', locale) } : undefined}
40204023
actions={
40214024
<>
4022-
{hasDraft && draftLoaded && (
4023-
<span className="rounded bg-amber-400/15 px-2 py-0.5 text-[11px] text-amber-600 dark:text-amber-300">
4024-
{t('engine.studio.unpublishedDraft', locale)}
4025-
</span>
4026-
)}
40274025
{/* objectui#5813 — drafts auto-save; the spinner is the affordance. */}
40284026
{saving === 'draft' && (
40294027
<span className="inline-flex items-center gap-1 text-[11px] text-muted-foreground" data-testid="if-autosaving">
@@ -5828,13 +5826,7 @@ export function DataPillar({
58285826
titleProps={current ? undefined : { className: 'text-[13px] font-normal text-muted-foreground' }}
58295827
apiName={current?.name}
58305828
meta={current && objLoaded ? tFormat('engine.studio.data.fieldCount', locale, { count: fieldCount }) : undefined}
5831-
chips={
5832-
hasDraft && objLoaded ? (
5833-
<span className="rounded bg-amber-400/15 px-2 py-0.5 text-[11px] text-amber-600 dark:text-amber-300">
5834-
{t('engine.studio.unpublishedDraft', locale)}
5835-
</span>
5836-
) : undefined
5837-
}
5829+
status={hasDraft && objLoaded ? { label: t('engine.studio.unpublishedDraft', locale) } : undefined}
58385830
actions={
58395831
<>
58405832
{/* objectui#5813 — drafts auto-save (see useDraftAutoSave above); the
@@ -7456,13 +7448,7 @@ export function AutomationsPillar({
74567448
<span className="hidden 2xl:inline">{t('engine.studio.auto.designersMissing', locale)}</span>
74577449
)
74587450
}
7459-
chips={
7460-
hasDraft && flowLoaded ? (
7461-
<span className="rounded bg-amber-400/15 px-2 py-0.5 text-[11px] text-amber-600 dark:text-amber-300">
7462-
{t('engine.studio.unpublishedDraft', locale)}
7463-
</span>
7464-
) : undefined
7465-
}
7451+
status={hasDraft && flowLoaded ? { label: t('engine.studio.unpublishedDraft', locale) } : undefined}
74667452
actions={
74677453
<>
74687454
{/* objectui#5813 — drafts auto-save; the spinner is the affordance. */}
@@ -8009,19 +7995,20 @@ export function AccessPillar({
80097995
// the note was, and the link's title carries the note's sentence. An open
80107996
// set's header draws it at the tab row's right end (objectui#12456: the
80117997
// title row truncated the set's label at the 1280 px design width).
8012-
const accessNoteEl = readOnly ? (
7998+
// objectui#12524 — the writable note is this pillar's draft status: the
7999+
// header draws it in the status place every pillar shares. The read-only
8000+
// link is an action, so it stays in the actions slot.
8001+
const accessStatus: StudioItemStatus | undefined = readOnly
8002+
? undefined
8003+
: { label: t('engine.studio.access.banner', locale), title: t('engine.studio.access.bannerTitle', locale) };
8004+
const accessNoteEl = accessStatus ? (
8005+
<StudioStatusChip {...accessStatus} />
8006+
) : (
80138007
<StudioReadOnlyLink
80148008
packageId={packageId}
80158009
title={t('engine.studio.access.bannerTitleReadOnly', locale)}
80168010
locale={locale}
80178011
/>
8018-
) : (
8019-
<span
8020-
title={t('engine.studio.access.bannerTitle', locale)}
8021-
className="rounded bg-amber-400/15 px-2 py-0.5 text-[11px] text-amber-600 dark:text-amber-300"
8022-
>
8023-
{t('engine.studio.access.banner', locale)}
8024-
</span>
80258012
);
80268013
const accessExplainEl = (
80278014
<button
@@ -8051,7 +8038,7 @@ export function AccessPillar({
80518038
icon={owdOpen ? ShieldCheck : Shield}
80528039
title={owdOpen ? t('engine.studio.owd.title', locale) : t('engine.studio.access.title', locale)}
80538040
meta={owdOpen ? t('engine.studio.owd.subtitle', locale) : t('engine.studio.access.subtitle', locale)}
8054-
chips={readOnly ? undefined : accessNoteEl}
8041+
status={accessStatus}
80558042
actions={
80568043
<>
80578044
{readOnly && accessNoteEl}
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* objectui#12524 — the draft status chip sits in the same place in every
5+
* pillar's item header.
6+
*
7+
* Measured in the 2026-10-15 Studio test pass (a writable package): Data and
8+
* Automations showed "Unpublished draft" beside the title, Access its "saved
9+
* as draft" note beside the title, and Interfaces "Unpublished draft" at the
10+
* far right, among the Design / Run actions. Four headers, two positions.
11+
*
12+
* `StudioItemHeader` now takes the status as data (`status`) and draws the
13+
* chip itself, after the identity (title, api-name or kind chips) and before
14+
* the meta; the right slot holds actions only. The identity chips sit in
15+
* one `contents` wrapper, so the chip is the same child of the same row
16+
* whatever identity chips a pillar shows.
17+
*
18+
* The REAL four pillars against one server double that serves a pending draft
19+
* for the open object, the open flow and the open page. Access has no
20+
* item-level draft: its writable "saved as draft" note is the pillar's status.
21+
*
22+
* Pinned:
23+
* - with a draft, the chip in all four headers is a child of the header's
24+
* title row at the same index, after the identity and outside the actions;
25+
* - the Interfaces actions keep their order with the chip gone from them;
26+
* - CONTROL: no draft (and, for Access, a read-only package), no chip, and
27+
* Access's read-only link stays in the actions slot.
28+
*/
29+
30+
import '@testing-library/jest-dom/vitest';
31+
import * as React from 'react';
32+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
33+
import { cleanup, render, screen, waitFor, within } from '@testing-library/react';
34+
import { MemoryRouter } from 'react-router-dom';
35+
36+
const PKG = 'com.acme.app';
37+
38+
const OBJECT = { name: 'acme_account', label: 'Account', fields: { title: { name: 'title', type: 'text' } } };
39+
const FLOW = {
40+
name: 'route_lead',
41+
label: 'Route lead',
42+
type: 'autolaunched',
43+
status: 'active',
44+
nodes: [
45+
{ id: 'start', type: 'start', label: 'Start', config: { triggerType: 'record-after-create', objectName: 'acme_account' } },
46+
{ id: 'end', type: 'end', label: 'End' },
47+
],
48+
edges: [{ id: 'e1', source: 'start', target: 'end' }],
49+
};
50+
const APP = { name: 'acme_app', label: 'Acme', navigation: [{ id: 'nav_home', type: 'page', label: 'Home', pageName: 'home' }] };
51+
const PAGE = {
52+
name: 'home',
53+
label: 'Home',
54+
type: 'app',
55+
regions: [{ name: 'main', components: [{ id: 'hello', type: 'element:text', properties: { content: 'Hello' } }] }],
56+
};
57+
58+
const server = vi.hoisted(() => ({
59+
active: new Map<string, Record<string, unknown>>(),
60+
/** Whether the open object, flow and page each have a pending draft. */
61+
drafts: true,
62+
}));
63+
64+
const mockClient = vi.hoisted(() => {
65+
const k = (type: string, name: string) => `${type}/${name}`;
66+
const client = {
67+
withPreviewDrafts: vi.fn((): unknown => client),
68+
list: vi.fn(async (type: string) =>
69+
[...server.active.entries()].filter(([key]) => key.startsWith(`${type}/`)).map(([, row]) => row),
70+
),
71+
listDrafts: vi.fn(async () => []),
72+
listTypes: vi.fn(async () => ({ entries: [] })),
73+
get: vi.fn(async () => null),
74+
references: vi.fn(async () => []),
75+
layered: vi.fn(async (type: string, name: string) => {
76+
const eff = server.active.get(k(type, name)) ?? null;
77+
return { code: null, overlay: eff, overlayScope: eff ? 'env' : null, effective: eff, editable: true, deletable: true, resettable: false, lock: 'none' };
78+
}),
79+
getDraft: vi.fn(async (type: string, name: string) => {
80+
const body = server.drafts && type !== 'app' ? server.active.get(k(type, name)) : undefined;
81+
if (body) return { item: JSON.parse(JSON.stringify(body)) };
82+
throw Object.assign(new Error(`No pending draft exists for ${type}/${name}.`), { code: 'NO_DRAFT', status: 404 });
83+
}),
84+
save: vi.fn(async (type: string, name: string, item: unknown) => ({ type, name, item })),
85+
publish: vi.fn(async () => ({ success: true })),
86+
reset: vi.fn(async () => ({})),
87+
};
88+
return client;
89+
});
90+
91+
vi.mock('../metadata-admin/useMetadata', async (importOriginal) => {
92+
const mod = await importOriginal<typeof import('../metadata-admin/useMetadata')>();
93+
return { ...mod, useMetadataClient: () => mockClient, useMetadataTypes: () => ({ entries: [] }) };
94+
});
95+
96+
vi.mock('./packages-io', async (importOriginal) => {
97+
const mod = await importOriginal<typeof import('./packages-io')>();
98+
return { ...mod, fetchPackages: vi.fn(async () => []) };
99+
});
100+
101+
vi.mock('@object-ui/react', async (importOriginal) => {
102+
const mod = await importOriginal<typeof import('@object-ui/react')>();
103+
return { ...mod, useAdapter: () => dataSource };
104+
});
105+
106+
vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
107+
108+
// The Access pillar's siblings that play no part in its header.
109+
vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPanel: () => null }));
110+
vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null }));
111+
112+
import { AccessPillar, AutomationsPillar, DataPillar, InterfacesPillar } from './StudioDesignSurface';
113+
import '../../services/builtinComponents.js';
114+
import { t } from '../metadata-admin/i18n';
115+
import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource';
116+
import { registerMetadataPreview } from '../metadata-admin/preview-registry';
117+
import { registerMetadataInspector } from '../metadata-admin/inspector-registry';
118+
import { registerMetadataDefaultInspector } from '../metadata-admin/default-inspector-registry';
119+
import { PagePreview } from '../metadata-admin/previews/PagePreview';
120+
import { PageBlockInspector } from '../metadata-admin/inspectors/PageBlockInspector';
121+
import { PageDefaultInspector } from '../metadata-admin/inspectors/PageDefaultInspector';
122+
import { FlowPreview } from '../metadata-admin/previews/FlowPreview';
123+
import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector';
124+
125+
const dataSource = createEmptyDataSource();
126+
failOnAbsorbedFetchError();
127+
128+
registerMetadataPreview('page', PagePreview);
129+
registerMetadataInspector('page', PageBlockInspector);
130+
registerMetadataDefaultInspector('page', PageDefaultInspector);
131+
registerMetadataPreview('flow', FlowPreview);
132+
registerMetadataInspector('flow', FlowInspector);
133+
134+
const en = (key: string) => t(key, 'en');
135+
136+
beforeEach(() => {
137+
server.active.clear();
138+
server.drafts = true;
139+
for (const [type, body] of [
140+
['object', OBJECT],
141+
['flow', FLOW],
142+
['app', APP],
143+
['page', PAGE],
144+
] as const) {
145+
server.active.set(`${type}/${body.name}`, JSON.parse(JSON.stringify(body)));
146+
}
147+
for (const fn of Object.values(mockClient)) (fn as unknown as { mockClear: () => void }).mockClear();
148+
vi.stubGlobal(
149+
'fetch',
150+
vi.fn(async () => new Response('null', { status: 404, headers: { 'content-type': 'application/json' } })),
151+
);
152+
});
153+
154+
afterEach(() => {
155+
cleanup();
156+
vi.unstubAllGlobals();
157+
});
158+
159+
type PillarCase = {
160+
pillar: string;
161+
testId: string;
162+
element: (readOnly: boolean) => React.ReactElement;
163+
/** Resolves once the open item's draft read has settled. */
164+
settled: (header: HTMLElement) => Promise<void>;
165+
};
166+
167+
const CASES: PillarCase[] = [
168+
{
169+
pillar: 'Data',
170+
testId: 'data-object-header',
171+
element: (readOnly) => <DataPillar packageId={PKG} readOnly={readOnly} />,
172+
settled: async (header) => {
173+
await within(header).findByText(OBJECT.name, undefined, { timeout: 8000 });
174+
},
175+
},
176+
{
177+
pillar: 'Automations',
178+
testId: 'auto-flow-header',
179+
element: (readOnly) => <AutomationsPillar packageId={PKG} readOnly={readOnly} />,
180+
settled: async () => {
181+
await screen.findByTestId('auto-flow-meta', undefined, { timeout: 8000 });
182+
},
183+
},
184+
{
185+
pillar: 'Interfaces',
186+
testId: 'if-item-header',
187+
element: (readOnly) => <InterfacesPillar packageId={PKG} readOnly={readOnly} />,
188+
settled: async () => {
189+
await screen.findByRole('button', { name: 'Select hello' }, { timeout: 8000 });
190+
},
191+
},
192+
{
193+
pillar: 'Access',
194+
testId: 'access-item-header',
195+
element: (readOnly) => <AccessPillar packageId={PKG} readOnly={readOnly} />,
196+
settled: async (header) => {
197+
await within(header).findByRole('button', { name: en('engine.studio.access.explain.open') }, { timeout: 8000 });
198+
},
199+
},
200+
];
201+
202+
async function openHeader(c: PillarCase, readOnly = false): Promise<HTMLElement> {
203+
render(<MemoryRouter initialEntries={[`/studio/${PKG}`]}>{c.element(readOnly)}</MemoryRouter>);
204+
const header = await screen.findByTestId(c.testId, undefined, { timeout: 8000 });
205+
await c.settled(header);
206+
return header;
207+
}
208+
209+
/** The header's title row: the row that holds the item's title. */
210+
function titleRow(header: HTMLElement): HTMLElement {
211+
const row = header.querySelector('h1')?.parentElement;
212+
expect(row, 'the header has no title row: the harness is dead').toBeTruthy();
213+
return row as HTMLElement;
214+
}
215+
216+
/** Where the status chip sits: its row and its index among the row's children. */
217+
async function statusPlace(header: HTMLElement): Promise<{ index: number; chip: HTMLElement; row: HTMLElement }> {
218+
const chip = await within(header).findByTestId('studio-item-status', undefined, { timeout: 8000 });
219+
const row = titleRow(header);
220+
return { index: Array.from(row.children).indexOf(chip), chip, row };
221+
}
222+
223+
describe('the status chip sits in the same place in every pillar’s item header (objectui#12524)', () => {
224+
it('with a draft, all four headers draw it as the same child of the title row: after the identity, before meta and actions', async () => {
225+
const places: Array<{ pillar: string; index: number; text: string }> = [];
226+
for (const c of CASES) {
227+
const header = await openHeader(c);
228+
const { index, chip, row } = await statusPlace(header);
229+
// A child of the title row, never of the actions slot.
230+
expect(chip.parentElement, c.pillar).toBe(row);
231+
// Right after the identity: the title, then the wrapper of its chips.
232+
expect(row.children[index - 2]?.tagName, `${c.pillar}: the chip does not follow the title`).toBe('H1');
233+
expect(row.children[index - 1], `${c.pillar}: the chip does not follow the identity chips`).toHaveAttribute(
234+
'data-slot',
235+
'identity-chips',
236+
);
237+
// Nothing after it is identity: the meta and the actions follow.
238+
for (const later of Array.from(row.children).slice(index + 1)) {
239+
expect(later.tagName, c.pillar).not.toBe('H1');
240+
expect(later.getAttribute('data-slot'), c.pillar).not.toBe('identity-chips');
241+
}
242+
places.push({ pillar: c.pillar, index, text: chip.textContent ?? '' });
243+
cleanup();
244+
}
245+
246+
expect(places.map((p) => p.pillar)).toEqual(['Data', 'Automations', 'Interfaces', 'Access']);
247+
// The same index in all four.
248+
expect(new Set(places.map((p) => p.index)).size, JSON.stringify(places)).toBe(1);
249+
// The three item drafts say so; Access says its edits save as drafts.
250+
expect(places.map((p) => p.text)).toEqual([
251+
en('engine.studio.unpublishedDraft'),
252+
en('engine.studio.unpublishedDraft'),
253+
en('engine.studio.unpublishedDraft'),
254+
en('engine.studio.access.banner'),
255+
]);
256+
});
257+
258+
it('the Interfaces actions keep their order, and the chip is no longer one of them', async () => {
259+
const header = await openHeader(CASES[2]);
260+
const { row } = await statusPlace(header);
261+
const actions = row.lastElementChild as HTMLElement;
262+
expect(within(actions).queryByTestId('studio-item-status')).toBeNull();
263+
expect(within(actions).queryByText(en('engine.studio.unpublishedDraft'))).toBeNull();
264+
const order = Array.from(actions.querySelectorAll('[data-testid]'))
265+
.map((el) => el.getAttribute('data-testid'))
266+
.filter((id) => id === 'canvas-mode-toggle' || id === 'if-properties-toggle');
267+
expect(order).toEqual(['canvas-mode-toggle', 'if-properties-toggle']);
268+
});
269+
270+
it('CONTROL: with no draft, Data, Automations and Interfaces draw no status chip', async () => {
271+
server.drafts = false;
272+
for (const c of CASES.slice(0, 3)) {
273+
const header = await openHeader(c);
274+
// The draft read has settled (the header's identity is in), and nothing says draft.
275+
await waitFor(() => expect(mockClient.getDraft).toHaveBeenCalled());
276+
expect(within(header).queryByTestId('studio-item-status'), c.pillar).toBeNull();
277+
expect(within(header).queryByText(en('engine.studio.unpublishedDraft')), c.pillar).toBeNull();
278+
cleanup();
279+
}
280+
});
281+
282+
it('CONTROL: a read-only package draws no Access status; its read-only link stays in the actions slot', async () => {
283+
const header = await openHeader(CASES[3], true);
284+
expect(within(header).queryByTestId('studio-item-status')).toBeNull();
285+
const link = within(header).getByTestId('studio-readonly-link');
286+
const row = titleRow(header);
287+
expect(link.parentElement).toBe(row.lastElementChild);
288+
expect(link.parentElement).toHaveClass('ml-auto');
289+
});
290+
});

0 commit comments

Comments
 (0)