-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add syntax highlighted markdown tests
- Loading branch information
1 parent
9a4faf5
commit 70f17bc
Showing
2 changed files
with
54 additions
and
20 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,36 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import MarkdownDescription from "./MarkdownDescription"; | ||
|
||
it("renders without crashing", () => { | ||
const div = document.createElement("div"); | ||
ReactDOM.render(<MarkdownDescription uiSchema={{}} />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); | ||
|
||
it("renders a description", () => { | ||
const div = document.createElement("div"); | ||
ReactDOM.render(<MarkdownDescription uiSchema={{}} source={"foo"}/>, div); | ||
expect(div.innerHTML).toContain("foo"); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); | ||
|
||
it("renders a description with syntax highlighting", () => { | ||
const div = document.createElement("div"); | ||
ReactDOM.render(<MarkdownDescription uiSchema={{}} source={"```javascript\n\nconst foo = 'bar';\n\n```"}/>, div); | ||
expect(div.innerHTML).toContain("language-javascript"); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); | ||
|
||
it("renders a description with darkmode syntax highlighting", () => { | ||
const div = document.createElement("div"); | ||
ReactDOM.render(<MarkdownDescription uiSchema={{appBar: {"ui:darkMode": true}}} source={"```javascript\n\nconst foo = 'bar';\n\n```"}/>, div); | ||
expect(div.innerHTML).toContain("language-javascript"); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); | ||
|
||
it("renders a description that errors", () => { | ||
const div = document.createElement("div"); | ||
ReactDOM.render(<MarkdownDescription uiSchema={{}} source={"```"}/>, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
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