mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-23 08:49:33 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
251f30a781 |
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("fits notification body and actions below the dismiss button in a narrow window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 420, height: 540 });
|
||||
const title = "Validation failed for the catalog service";
|
||||
const body = "The build stopped while checking the catalog response type.";
|
||||
const action = "recheckCatalogServiceResponsePayloadAfterRegeneratingTypesForDevelopment";
|
||||
await page.evaluate(
|
||||
async ({ title, body, action }) => {
|
||||
const servicePath = "/src/workbench/contributions.ts";
|
||||
const { notifications } = await import(/* @vite-ignore */ servicePath);
|
||||
notifications().notify({
|
||||
level: "error",
|
||||
title,
|
||||
body,
|
||||
actions: [{ label: action, run: () => document.body.setAttribute("data-validation-retried", "true") }],
|
||||
});
|
||||
},
|
||||
{ title, body, action },
|
||||
);
|
||||
|
||||
const balloon = page.getByRole("alert").filter({ hasText: title });
|
||||
const message = balloon.getByText(body, { exact: true });
|
||||
const dismiss = balloon.getByRole("button", { name: "Dismiss", exact: true });
|
||||
const retry = balloon.getByRole("button", { name: action, exact: true });
|
||||
await expect(balloon).toBeInViewport({ ratio: 1 });
|
||||
const [messageBox, dismissBox] = await Promise.all([message.boundingBox(), dismiss.boundingBox()]);
|
||||
expect(messageBox!.y).toBeGreaterThanOrEqual(dismissBox!.y + dismissBox!.height);
|
||||
expect(messageBox!.x + messageBox!.width).toBeGreaterThanOrEqual(dismissBox!.x + dismissBox!.width - 1);
|
||||
expect(await retry.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await retry.click();
|
||||
await expect(page.locator("body")).toHaveAttribute("data-validation-retried", "true");
|
||||
await expect(balloon).toBeHidden();
|
||||
});
|
||||
+22
-54
@@ -101,22 +101,26 @@
|
||||
}
|
||||
|
||||
.toast {
|
||||
position: relative;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
width: 340px;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
align-items: start;
|
||||
column-gap: var(--space-2);
|
||||
row-gap: var(--space-1);
|
||||
width: 360px;
|
||||
max-width: 100%;
|
||||
/* Never grow past the window: the close button must stay reachable. */
|
||||
max-height: calc(100vh - 48px);
|
||||
padding: 14px 34px 14px 14px;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
background: var(--bg-popup);
|
||||
border: 1px solid var(--border-popup);
|
||||
border-radius: var(--radius-popup-large, 10px);
|
||||
box-shadow: var(--shadow-balloon);
|
||||
color: var(--fg);
|
||||
font-size: var(--fs-ui);
|
||||
}
|
||||
.toastIcon {
|
||||
margin-top: 0;
|
||||
grid-area: 1 / 1;
|
||||
margin-top: var(--space-0-5);
|
||||
}
|
||||
.level-info {
|
||||
color: var(--info);
|
||||
@@ -130,18 +134,12 @@
|
||||
.level-success {
|
||||
color: var(--success);
|
||||
}
|
||||
.toastMain {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
.toastHead {
|
||||
grid-area: 1 / 2;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: var(--space-2);
|
||||
min-height: 16px;
|
||||
min-height: 20px;
|
||||
}
|
||||
.toastTitle {
|
||||
flex: 1;
|
||||
@@ -155,6 +153,10 @@
|
||||
color: var(--fg-subtle);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
.toastBody,
|
||||
.toastActions {
|
||||
grid-column: 2 / -1;
|
||||
}
|
||||
.toastBody {
|
||||
color: var(--fg-secondary);
|
||||
overflow-wrap: anywhere;
|
||||
@@ -170,29 +172,25 @@
|
||||
.toastActions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 14px;
|
||||
margin-top: 4px;
|
||||
gap: var(--space-1) var(--space-3);
|
||||
margin-top: var(--space-1);
|
||||
}
|
||||
.link {
|
||||
color: var(--link);
|
||||
cursor: pointer;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
text-align: start;
|
||||
}
|
||||
.link:hover {
|
||||
color: var(--link-hover);
|
||||
}
|
||||
.toastClose {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
grid-area: 1 / 3;
|
||||
}
|
||||
|
||||
.toastHistory {
|
||||
container: toast-history / inline-size;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
align-items: start;
|
||||
column-gap: var(--space-2);
|
||||
row-gap: var(--space-1);
|
||||
width: 100%;
|
||||
max-height: none;
|
||||
padding: var(--space-2);
|
||||
@@ -200,51 +198,21 @@
|
||||
border-radius: var(--radius-selection);
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
font-size: var(--fs-ui);
|
||||
}
|
||||
.toastHistory:hover,
|
||||
.toastHistory:focus-within {
|
||||
background: var(--bg-tree-hover);
|
||||
}
|
||||
.toastHistory .toastMain {
|
||||
display: contents;
|
||||
}
|
||||
.toastHistory .toastHead {
|
||||
grid-area: 1 / 2;
|
||||
min-height: 20px;
|
||||
}
|
||||
.toastHistory .toastIcon {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.toastHistory .toastMeta {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.toastHistory .toastBody,
|
||||
.toastHistory .toastActions {
|
||||
grid-column: 2 / -1;
|
||||
}
|
||||
.toastHistory .toastBody {
|
||||
max-height: none;
|
||||
overflow: visible;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.toastHistory .toastActions {
|
||||
gap: var(--space-1) var(--space-3);
|
||||
}
|
||||
.toastHistory .link {
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
text-align: start;
|
||||
}
|
||||
.toastHistory .toastClose {
|
||||
position: static;
|
||||
grid-area: 1 / 3;
|
||||
}
|
||||
|
||||
@container toast-history (max-width: 220px) {
|
||||
.toastHistory .toastIcon {
|
||||
grid-area: 1 / 1;
|
||||
}
|
||||
.toastHistory .toastHead {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
+15
-17
@@ -117,24 +117,22 @@ export function Toast({
|
||||
onPointerLeave={onPointerLeave}
|
||||
>
|
||||
<Icon name={LEVEL_ICON[level]} size={16} className={clsx(styles.toastIcon, styles[`level-${level}`])} />
|
||||
<div className={styles.toastMain}>
|
||||
<div className={styles.toastHead}>
|
||||
<span className={clsx(styles.toastTitle, selectableText)}>
|
||||
{typeof title === "string" ? <Given>{title}</Given> : title}
|
||||
</span>
|
||||
{meta && <span className={styles.toastMeta}>{meta}</span>}
|
||||
</div>
|
||||
{body && <div className={styles.toastBody}>{typeof body === "string" ? <Given>{body}</Given> : body}</div>}
|
||||
{actions && actions.length > 0 && (
|
||||
<div className={styles.toastActions}>
|
||||
{actions.map((a) => (
|
||||
<button key={a.label} type="button" className={styles.link} onClick={a.run}>
|
||||
<Given>{a.label}</Given>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.toastHead}>
|
||||
<span className={clsx(styles.toastTitle, selectableText)}>
|
||||
{typeof title === "string" ? <Given>{title}</Given> : title}
|
||||
</span>
|
||||
{meta && <span className={styles.toastMeta}>{meta}</span>}
|
||||
</div>
|
||||
{body && <div className={styles.toastBody}>{typeof body === "string" ? <Given>{body}</Given> : body}</div>}
|
||||
{actions && actions.length > 0 && (
|
||||
<div className={styles.toastActions}>
|
||||
{actions.map((a) => (
|
||||
<button key={a.label} type="button" className={styles.link} onClick={a.run}>
|
||||
<Given>{a.label}</Given>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{onClose && (
|
||||
<IconButton
|
||||
icon="close"
|
||||
|
||||
Reference in new issue
Block a user