Skip to content

Commit 2f5902b

Browse files
committed
Merge branch 'supervisor-dialog-flat-redesign' into develop
2 parents 3be2ca3 + 95a7251 commit 2f5902b

6 files changed

Lines changed: 375 additions & 112 deletions

File tree

packages/web/src/features/supervisor/components/objective-dialog.test.tsx

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,45 @@ describe("ObjectiveDialog", () => {
179179
expect(screen.getByRole("textbox", { name: "Objective" })).toHaveClass("input", "textarea");
180180
});
181181

182+
it("renders the intro strip in the desktop wrapper for enable mode", () => {
183+
const store = createStore();
184+
window.localStorage.setItem("ui.locale", JSON.stringify("en"));
185+
store.set(localeAtom, "en");
186+
store.set(wsClientAtom, { sendCommand: vi.fn() } as never);
187+
store.set(
188+
supervisorDialogAtom,
189+
createDialogState({
190+
draftObjective: "Ship phase 4B1",
191+
})
192+
);
193+
store.set(supervisorsAtom, new Map());
194+
195+
render(
196+
<Provider store={store}>
197+
<ObjectiveDialog workspaceId="ws-1" />
198+
</Provider>
199+
);
200+
201+
const dialog = screen.getByRole("dialog");
202+
const header = dialog.querySelector(".dialog-header");
203+
const intro = dialog.querySelector(".supervisor-dialog-intro");
204+
const introIcon = dialog.querySelector(".supervisor-dialog-intro__icon");
205+
const introCopy = dialog.querySelector(".supervisor-dialog-intro__copy");
206+
const firstFormGroup = dialog.querySelector(".form-group");
207+
208+
expect(header).toBeTruthy();
209+
expect(intro).toBeTruthy();
210+
expect(introIcon).toBeTruthy();
211+
expect(introCopy).toBeTruthy();
212+
expect(intro?.querySelector(".supervisor-dialog-intro__icon")).toBe(introIcon);
213+
expect(intro?.querySelector(".supervisor-dialog-intro__copy")).toBe(introCopy);
214+
expect(header?.contains(intro as Node)).toBe(false);
215+
expect(firstFormGroup).toBeTruthy();
216+
expect(intro?.compareDocumentPosition(firstFormGroup as Node)).toBe(
217+
Node.DOCUMENT_POSITION_FOLLOWING
218+
);
219+
});
220+
182221
it("renders disable confirmation mode", () => {
183222
const store = createStore();
184223
window.localStorage.setItem("ui.locale", JSON.stringify("en"));
@@ -201,6 +240,7 @@ describe("ObjectiveDialog", () => {
201240
expect(screen.getByText("Disabling stops evaluation cycles")).toBeInTheDocument();
202241
expect(screen.getByText("Finish the server refactor")).toBeInTheDocument();
203242
expect(screen.getByRole("dialog")).toHaveClass("supervisor-dialog--disable");
243+
expect(document.querySelector(".supervisor-dialog-intro")).toBeNull();
204244
});
205245

206246
it("renders the dialog header through the canonical dialog header anatomy", () => {
@@ -234,9 +274,45 @@ describe("ObjectiveDialog", () => {
234274
expect(leading).not.toBeNull();
235275
expect(icon).not.toBeNull();
236276
expect(copy).not.toBeNull();
237-
expect(description).toHaveTextContent(
238-
"Stop automatic evaluation. The current session's supervision cycles will be removed."
277+
expect(copy).toHaveTextContent("Disable Supervisor");
278+
expect(description).toBeNull();
279+
expect(closeButton).toHaveClass("modal-close");
280+
});
281+
282+
it("keeps the canonical dialog header anatomy for enable mode", () => {
283+
const store = createStore();
284+
window.localStorage.setItem("ui.locale", JSON.stringify("en"));
285+
store.set(localeAtom, "en");
286+
store.set(wsClientAtom, { sendCommand: vi.fn() } as never);
287+
store.set(
288+
supervisorDialogAtom,
289+
createDialogState({
290+
mode: "enable",
291+
draftObjective: "Ship phase 4B1",
292+
})
293+
);
294+
store.set(supervisorsAtom, new Map());
295+
296+
render(
297+
<Provider store={store}>
298+
<ObjectiveDialog workspaceId="ws-1" />
299+
</Provider>
239300
);
301+
302+
const dialog = screen.getByRole("dialog");
303+
const header = dialog.querySelector(".dialog-header");
304+
const leading = header?.querySelector(".dialog-header__leading");
305+
const icon = header?.querySelector(".dialog-header__icon");
306+
const copy = header?.querySelector(".dialog-header__copy");
307+
const description = header?.querySelector(".dialog-header__description");
308+
const closeButton = screen.getByRole("button", { name: "Close" });
309+
310+
expect(header).not.toBeNull();
311+
expect(leading).not.toBeNull();
312+
expect(icon).not.toBeNull();
313+
expect(copy).not.toBeNull();
314+
expect(copy).toHaveTextContent("Enable Supervisor");
315+
expect(description).toBeNull();
240316
expect(closeButton).toHaveClass("modal-close");
241317
});
242318

0 commit comments

Comments
 (0)