Skip to content

Commit 398596e

Browse files
committed
feat: Add debug prop to test case component functions
1 parent f76782e commit 398596e

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

packages/cursorless-org/src/pages/component-sheet.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,25 @@ export async function getStaticProps() {
8686
export type TestCaseComponentProps = TestCaseFixture & {
8787
filename: string;
8888
raw: TestCaseFixture;
89-
before: string;
90-
during: string;
91-
after: string;
89+
before: { html: string; data: string[] };
90+
during: { html: string; data: string[] };
91+
after: { html: string; data: string[] };
92+
debug?: boolean;
9293
};
9394

94-
export function App({ data }: { data: TestCaseComponentProps[] }) {
95+
export function App({
96+
data,
97+
debug,
98+
}: {
99+
data: TestCaseComponentProps[];
100+
debug?: boolean;
101+
}) {
95102
return (
96103
<>
97104
<Head>
98105
<title>Cursorless Test Case Component Page</title>
99106
</Head>
100-
<TestCaseComponentPage data={data} />
107+
<TestCaseComponentPage data={data} debug={debug} />
101108
</>
102109
);
103110
}

packages/test-case-component/src/components/TestCaseComponentPage.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ import type { TestCaseFixture } from "@cursorless/common";
77
export type TestCaseComponentProps = TestCaseFixture & {
88
filename: string;
99
raw: TestCaseFixture;
10-
before: string;
11-
during: string;
12-
after: string;
10+
before: { html: string; data: string[] };
11+
during: { html: string; data: string[] };
12+
after: { html: string; data: string[] };
1313
};
1414

1515
export function TestCaseComponentPage({
1616
data,
17+
debug,
1718
}: {
1819
data: TestCaseComponentProps[];
20+
debug?: boolean;
1921
}) {
2022
return (
2123
<main className="dark:text-stone-100">
@@ -35,7 +37,9 @@ export function TestCaseComponentPage({
3537
}
3638
const { filename } = item;
3739
if (filename) {
38-
return <ShikiComponent data={item} key={item.filename} />;
40+
return (
41+
<ShikiComponent data={item} debug={debug} key={item.filename} />
42+
);
3943
} else {
4044
return <></>;
4145
}

packages/test-case-component/src/generateHtml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class HTMLGenerator {
159159
const errorRendered = `<pre><code>Omitted due to errors: ${error}</pre></code>`
160160
htmlArray.push(errorRendered)
161161
}
162-
return htmlArray.join("")
162+
return { html: htmlArray.join(""), data: [] }
163163
}
164164

165165
async generateAll() {

0 commit comments

Comments
 (0)