fix(tests): remove low-value source snapshots and define test standards
This commit is contained in:
80 files changed
+14
-2225
No files matched your search
@@ -1,41 +0,0 @@
|
||||
// Source-contract guard for the ErrorBanner "centered" variant (the query
|
||||
// execution error panel rendered by DataGrid).
|
||||
|
||||
// Overview: the centered banner is the only scroll surface for execution
|
||||
// errors — every ancestor up the results pane is overflow-hidden (DataGrid
|
||||
// root and content cell, splitpanes pane), so the pane height must reach the
|
||||
// message box through the flex chain (banner root `flex-1 min-h-0`). A fixed
|
||||
// `max-h-*` cap on the message box breaks that chain: long error text gets
|
||||
// clipped at the cap, and in a short pane the tiny internal scrollbar is
|
||||
// clipped out of view entirely — see #7960 (错误信息面板无法展示完整错误信息).
|
||||
//
|
||||
// These guarantees are what stop that from re-happening:
|
||||
// 1. The message box keeps `min-h-0` (the flex-shrink enabler) and
|
||||
// `overflow-y-auto` (the internal scroller) with NO fixed max-height.
|
||||
// 2. The message text keeps `whitespace-pre-wrap break-words`: backend
|
||||
// errors are multi-line ("summary\n\ndetail"); `break-all` collapsed
|
||||
// those newlines into a dense wall of text, and without wrap guards a
|
||||
// long token could force horizontal overflow.
|
||||
// If either is removed, the clipping regresses. Keep these assertions updated
|
||||
// alongside the component whenever the class strings are touched.
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const errorBannerSource = readFileSync(new URL("../ErrorBanner.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("ErrorBanner centered layout guard", () => {
|
||||
it("bounds the centered message box by the flex chain, not a fixed max-height", () => {
|
||||
// The box must stay shrinkable in both axes (`min-h-0 min-w-0`) and scroll internally
|
||||
// (`overflow-y-auto`); a fixed `max-h-48` cap re-introduces #7960.
|
||||
expect(errorBannerSource).toContain('class="min-h-0 min-w-0 max-w-lg overflow-y-auto space-y-1 select-text text-destructive"');
|
||||
expect(errorBannerSource).not.toContain("max-h-48");
|
||||
});
|
||||
|
||||
it("preserves backend error newlines and wraps long tokens", () => {
|
||||
// `text-left` keeps multi-line errors scannable under the centered
|
||||
// variant's inherited `text-center` (single-line messages are unaffected:
|
||||
// the box hugs its content).
|
||||
expect(errorBannerSource).toContain("text-xs whitespace-pre-wrap break-words text-left cursor-text");
|
||||
});
|
||||
});
|
||||
@@ -1,43 +0,0 @@
|
||||
// Source-contract guard for the shared dialog layout primitives.
|
||||
|
||||
// Overview: `DialogContent` renders a single-column CSS grid (no explicit
|
||||
// `grid-template-columns`). By default a grid's implicit track sizes to the
|
||||
// *max-content* of its children, so any child with a large min-content (e.g. a
|
||||
// footer that lays out many `whitespace-nowrap` buttons on one line) can push
|
||||
// the track wider than the dialog's `max-w-*`. The dialog's `overflow-hidden`
|
||||
// then clips the right edge without any scrollbar or ellipsis — see #7325
|
||||
// (Update dialog clips release notes and buttons on wide locales).
|
||||
//
|
||||
// These two guarantees are what stop that from re-happening:
|
||||
// 1. `grid-cols-[minmax(0,1fr)]` pins the track to the dialog's available
|
||||
// width and lets grid items shrink (equivalent to `min-width: 0`).
|
||||
// 2. `sm:flex-wrap` on the footer lets a long row of buttons wrap instead of
|
||||
// forcing the track wide.
|
||||
// If either is removed, the clipping regresses. Keep these assertions updated
|
||||
// alongside the components whenever the class strings are touched.
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const dialogContentSource = readFileSync(new URL("../DialogContent.vue", import.meta.url), "utf8");
|
||||
const dialogFooterSource = readFileSync(new URL("../DialogFooter.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("dialog layout guard", () => {
|
||||
it("pins the DialogContent grid track to the dialog width so children can shrink", () => {
|
||||
// The base class (before `props.class`) must lock the implicit track to the
|
||||
// available width. Without this, a wide grid item re-expands the track beyond
|
||||
// `max-w-*` and the dialog's `overflow-hidden` clips content (issue #7325).
|
||||
expect(dialogContentSource).toContain("relative grid grid-cols-[minmax(0,1fr)]");
|
||||
// Keep it on the shared base class, not a per-dialog override, so every dialog
|
||||
// that reuses DialogContent is protected.
|
||||
expect(dialogContentSource).toMatch(/'[^']*relative grid grid-cols-\[minmax\(0,1fr\)\]/);
|
||||
});
|
||||
|
||||
it("lets the dialog footer wrap so a row of buttons does not widen the track", () => {
|
||||
// At the sm breakpoint the footer is a no-wrap row; a long label (e.g. the
|
||||
// Spanish "Descargar e instalar") plus other actions then overflows. Wrapping
|
||||
// keeps the footer's min-content down to one button, which in turn keeps the
|
||||
// `minmax(0,1fr)` track inside the dialog.
|
||||
expect(dialogFooterSource).toMatch(/flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user