Skip to content

Commit e47a852

Browse files
committed
test: fix test from component
1 parent b9f17c3 commit e47a852

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/packages/tooltip/tooltipContent.test.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { TooltipContent } from "./tooltipContent";
33
describe("TooltipContent", () => {
44
it("renders plain text when tooltipRenderAsHtml is false", () => {
55
const el = TooltipContent({
6-
text: "Hello, tooltip!",
6+
text: "<strong>Bold Text</strong>",
77
tooltipRenderAsHtml: false,
88
});
99

10-
expect(el.textContent).toBe("Hello, tooltip!");
11-
expect(el.innerHTML).toBe("Hello, tooltip!");
12-
expect(el.className).toBe("introjs-tooltiptext");
10+
expect(el.innerHTML).toBe("&lt;strong&gt;Bold Text&lt;/strong&gt;");
11+
expect(el.querySelector("strong")).toBeNull();
1312
});
1413

1514
it("renders HTML content when tooltipRenderAsHtml is true", () => {
@@ -31,20 +30,4 @@ describe("TooltipContent", () => {
3130
expect(el.className).toBe("my-custom-tooltip");
3231
expect(el.textContent).toBe("Custom class test");
3332
});
34-
35-
it("clears old content on re-derivation", () => {
36-
const el = TooltipContent({
37-
text: "<i>Initial</i>",
38-
tooltipRenderAsHtml: true,
39-
});
40-
41-
el.innerHTML = "<b>Old Content</b>"; // Simulate old content
42-
const updated = TooltipContent({
43-
text: "Updated text",
44-
tooltipRenderAsHtml: false,
45-
});
46-
47-
expect(updated.innerHTML).toBe("Updated text");
48-
expect(updated.querySelector("b")).toBeNull();
49-
});
5033
});

0 commit comments

Comments
 (0)