Skip to content

Commit ecefd34

Browse files
committed
test case fixed and start tour preview window fix
Signed-off-by: nitro56565 <nitro56565@gmail.com>
1 parent 43bd84a commit ecefd34

File tree

5 files changed

+46
-11
lines changed

5 files changed

+46
-11
lines changed

package-lock.json

Lines changed: 32 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"core-js": "^3.37.1",
2929
"highlight.js": "^11.10.0",
3030
"immer": "^10.1.1",
31+
"jest-canvas-mock": "^2.5.2",
3132
"lz-string": "^1.5.0",
3233
"monaco-editor": "^0.50.0",
3334
"node-stdlib-browser": "^1.2.0",

src/AgreementHtml.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function AgreementHtml({
1616

1717
return (
1818
<div
19-
className="column"
19+
className="column preview-component"
2020
style={{
2121
border: "1px solid #d9d9d9",
2222
borderRadius: "8px",

src/components/Tour.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ tour.addStep({
6363
id: "preview",
6464
text: "This section shows the live preview of your template. View the results of your edits and see how your template renders.",
6565
attachTo: {
66-
element: ".anticon-fullscreen",
66+
element: ".preview-component",
6767
on: "bottom",
6868
},
6969
buttons: [

src/tests/components/Navbar.test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { render, screen } from "@testing-library/react";
22
import "@testing-library/jest-dom";
33
import Navbar from "../../components/Navbar";
44
import { MemoryRouter } from "react-router-dom";
5+
import { vi } from "vitest";
6+
7+
vi.mock("../../components/ToggleDarkMode", () => ({
8+
default: () => <div data-testid="toggle-dark-mode">Dark Mode Toggle</div>,
9+
}));
510

611
const renderNavbar = () => {
712
render(
@@ -40,4 +45,10 @@ describe("Navbar", () => {
4045
backgroundColor: "rgba(255, 255, 255, 0.1)",
4146
});
4247
});
48+
49+
it("renders Dark Mode Toggle button", () => {
50+
renderNavbar();
51+
const toggleDarkMode = screen.getByTestId("toggle-dark-mode");
52+
expect(toggleDarkMode).toBeInTheDocument();
53+
});
4354
});

0 commit comments

Comments
 (0)