fix(connection): refresh and display connection notes
This commit is contained in:
19 files changed
+199
-19
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { alignedCommentLeadingWidth, alignedSidebarCommentLabelWidths, canTreeNodeShowExpander, sidebarTreeNaturalContentWidth, trailingCommentAvailableWidth, treeLabelWidthClass, usesFullWidthTreeLabel } from "@/lib/sidebar/sidebarTreeItemLayout";
|
||||
import { alignedCommentLeadingWidth, alignedSidebarCommentLabelWidths, canTreeNodeShowExpander, sidebarTreeNaturalContentWidth, sidebarTreeNodeComment, trailingCommentAvailableWidth, treeLabelWidthClass, usesFullWidthTreeLabel } from "@/lib/sidebar/sidebarTreeItemLayout";
|
||||
import type { TreeNode } from "@/types/database";
|
||||
|
||||
describe("sidebar tree item layout", () => {
|
||||
it("keeps a table row constrained when it displays a comment", () => {
|
||||
@@ -7,6 +8,12 @@ describe("sidebar tree item layout", () => {
|
||||
expect(usesFullWidthTreeLabel("table", true, true)).toBe(false);
|
||||
});
|
||||
|
||||
it("shows connection notes only after the user opts in", () => {
|
||||
const connection: TreeNode = { id: "connection-1", label: "MySQL", type: "connection", comment: "Production" };
|
||||
expect(sidebarTreeNodeComment(connection, false)).toBeNull();
|
||||
expect(sidebarTreeNodeComment(connection, true)).toBe("Production");
|
||||
});
|
||||
|
||||
it("lets a table name consume the available row width before truncating when aligned", () => {
|
||||
expect(treeLabelWidthClass({ fullWidth: false, hasTrailingComment: true, alignLeading: true })).toBe("min-w-0 flex-1 truncate");
|
||||
// inline/right 模式 label 不撑满,让 comment 紧跟
|
||||
|
||||
Reference in new issue
Block a user