mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
fix: expand and align publish diagnostics
This commit is contained in:
1 parent
d50d7e7ed0
commit
8302d2f5ab
2 files changed
+58
-1
No files matched your search
@@ -396,6 +396,53 @@ test("collapses each complete publish and copies its full log from the header",
|
||||
expect(triggers[0]?.getAttribute("aria-expanded")).toBe("true");
|
||||
});
|
||||
|
||||
test("can maximize Diagnostics and aligns publish content with its title", async () => {
|
||||
render(
|
||||
[],
|
||||
true,
|
||||
[
|
||||
{
|
||||
buildId: "build-1",
|
||||
target: "site",
|
||||
domains: ["example.com"],
|
||||
findings: [],
|
||||
status: "success",
|
||||
logState: "available",
|
||||
logText: "Build output",
|
||||
},
|
||||
],
|
||||
undefined,
|
||||
true
|
||||
);
|
||||
|
||||
const dialog = document.body.querySelector<HTMLElement>('[role="dialog"]');
|
||||
const titleButton = document.body.querySelector<HTMLButtonElement>(
|
||||
"button[aria-labelledby]"
|
||||
);
|
||||
const title = document.getElementById(
|
||||
titleButton?.getAttribute("aria-labelledby") ?? ""
|
||||
);
|
||||
const log = document.body.querySelector<HTMLElement>("pre");
|
||||
expect(dialog).not.toBeNull();
|
||||
expect(title).not.toBeNull();
|
||||
expect(log).not.toBeNull();
|
||||
expect(
|
||||
Math.abs(
|
||||
title!.getBoundingClientRect().left - log!.getBoundingClientRect().left
|
||||
)
|
||||
).toBeLessThan(1);
|
||||
|
||||
const width = dialog!.getBoundingClientRect().width;
|
||||
const maximize = document.body.querySelector<HTMLButtonElement>(
|
||||
'button[aria-label="Expand"]'
|
||||
);
|
||||
expect(maximize).not.toBeNull();
|
||||
await act(async () => userEvent.click(maximize!));
|
||||
expect(dialog!.getBoundingClientRect().width).not.toBe(width);
|
||||
await act(async () => userEvent.click(maximize!));
|
||||
expect(dialog!.getBoundingClientRect().width).toBe(width);
|
||||
});
|
||||
|
||||
test("publish failure is plain text and links to the Publish tab", async () => {
|
||||
render(
|
||||
[
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogMaximize,
|
||||
DialogTitle,
|
||||
DialogTitleActions,
|
||||
Flex,
|
||||
@@ -21,6 +22,7 @@ import {
|
||||
SectionTitleLabel,
|
||||
Separator,
|
||||
Text,
|
||||
theme,
|
||||
} from "@webstudio-is/design-system";
|
||||
import { CopyIcon } from "@webstudio-is/icons";
|
||||
import { CopyToClipboard } from "~/shared/copy-to-clipboard";
|
||||
@@ -250,6 +252,7 @@ export const PublishDiagnosticsDialog = ({
|
||||
css={{ display: "flex", flexDirection: "column" }}
|
||||
>
|
||||
<DialogTitle
|
||||
maximizable
|
||||
suffix={
|
||||
<DialogTitleActions>
|
||||
{canViewPublishLogs && copyText.length > 0 && (
|
||||
@@ -263,6 +266,7 @@ export const PublishDiagnosticsDialog = ({
|
||||
</IconButton>
|
||||
</CopyToClipboard>
|
||||
)}
|
||||
<DialogMaximize />
|
||||
<DialogClose />
|
||||
</DialogTitleActions>
|
||||
}
|
||||
@@ -406,7 +410,13 @@ export const PublishDiagnosticsDialog = ({
|
||||
</SectionTitle>
|
||||
</Collapsible.Trigger>
|
||||
<Collapsible.Content asChild>
|
||||
<Flex direction="column" gap={2}>
|
||||
<Flex
|
||||
direction="column"
|
||||
gap={2}
|
||||
css={{
|
||||
paddingInline: theme.panel.paddingInline,
|
||||
}}
|
||||
>
|
||||
<Text color="subtle">
|
||||
{item.status === "pending"
|
||||
? "Publishing started"
|
||||
|
||||
Reference in new issue
Block a user