Skip to content

Commit

Permalink
chore: fix some tests and building
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Apr 14, 2024
1 parent ac9b8e0 commit 7dd6933
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/docs/scripts/createScssLookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createScssLookup } from "docs-generator/scripts/create-scss-lookup";
import { logComplete } from "docs-generator/utils/log";

if (!process.argv.includes("--watch")) {
createScssLookup();
await createScssLookup();
process.exit(0);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "esnext",
"noEmit": true,
"jsx": "preserve",
"strict": true,
Expand Down
21 changes: 21 additions & 0 deletions packages/code/src/__tests__/HighlightedCodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { describe, expect, it } from "@jest/globals";
import { render, screen } from "@react-md/core/test-utils";
import { HighlightedCodeBlock } from "../HighlightedCodeBlock.js";
import { highlightCode } from "../prismjs/highlight.js";

describe("HighlightedCodeBlock", () => {
it("should auto highlight children", () => {
render(
<HighlightedCodeBlock
containerProps={{ "data-testid": "container" }}
language="ts"
highlightCode={highlightCode}
>
const x = 3;
</HighlightedCodeBlock>
);

const container = screen.getByTestId("container");
expect(container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`HighlightedCodeBlock should auto highlight children 1`] = `
<div
class="code-block rmd-text-primary-color rmd-dark-surface"
data-testid="container"
>
<div
class="code-block__scroll-container"
>
<div
class="code-block__pre-container"
>
<pre
class="language-ts code-block__pre"
>
<code
class="language-ts"
>
<span
class="token keyword"
>
const
</span>
x
<span
class="token operator"
>
=
</span>
<span
class="token number"
>
3
</span>
<span
class="token punctuation"
>
;
</span>
</code>
</pre>
</div>
</div>
</div>
`;
2 changes: 1 addition & 1 deletion packages/core/src/avatar/__tests__/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("Avatar", () => {
const { rerender } = render(<Avatar {...props} />);

const avatar = screen.getByTestId("avatar");
const img = screen.getByRole("img", { hidden: true });
const img = screen.getByRole("presentation", { hidden: true });
expect(img).toHaveAttribute("src", props.src);
expect(img).toHaveAttribute("alt", "");
expect(avatar).toMatchSnapshot();
Expand Down

0 comments on commit 7dd6933

Please sign in to comment.