-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7018481
commit 6a6837f
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { lgTest } from "./lgTest" | ||
import { expect, describe, vi } from "vitest" | ||
import { LGraphCanvas } from "@/LGraphCanvas" | ||
import { LinkRenderType } from "@/types/globalEnums" | ||
|
||
describe("Link rendering", () => { | ||
lgTest("should not draw link mouseover effect when links are hidden", () => { | ||
const mockCtx = { | ||
fillText: vi.fn(), | ||
measureText: vi.fn(() => ({ width: 100 })), | ||
} as unknown as CanvasRenderingContext2D | ||
|
||
const mockLink = {} as any | ||
|
||
const mockCanvas: Partial<LGraphCanvas> = { | ||
links_render_mode: LinkRenderType.HIDDEN_LINK, | ||
} as LGraphCanvas | ||
|
||
// Directly call the method that draws link mouseover effects and tooltips | ||
const drawLinkTooltip = LGraphCanvas.prototype.drawLinkTooltip | ||
drawLinkTooltip.call(mockCanvas, mockCtx, mockLink) | ||
|
||
// Verify that no text rendering was attempted | ||
expect(mockCtx.fillText).not.toHaveBeenCalled() | ||
}) | ||
}) |