|
| 1 | +import React from "react"; |
| 2 | +import ReactDOM from "react-dom"; |
| 3 | +import MarkdownDescription from "./MarkdownDescription"; |
| 4 | + |
| 5 | +it("renders without crashing", () => { |
| 6 | + const div = document.createElement("div"); |
| 7 | + ReactDOM.render(<MarkdownDescription uiSchema={{}} />, div); |
| 8 | + ReactDOM.unmountComponentAtNode(div); |
| 9 | +}); |
| 10 | + |
| 11 | +it("renders a description", () => { |
| 12 | + const div = document.createElement("div"); |
| 13 | + ReactDOM.render(<MarkdownDescription uiSchema={{}} source={"foo"}/>, div); |
| 14 | + expect(div.innerHTML).toContain("foo"); |
| 15 | + ReactDOM.unmountComponentAtNode(div); |
| 16 | +}); |
| 17 | + |
| 18 | +it("renders a description with syntax highlighting", () => { |
| 19 | + const div = document.createElement("div"); |
| 20 | + ReactDOM.render(<MarkdownDescription uiSchema={{}} source={"```javascript\n\nconst foo = 'bar';\n\n```"}/>, div); |
| 21 | + expect(div.innerHTML).toContain("language-javascript"); |
| 22 | + ReactDOM.unmountComponentAtNode(div); |
| 23 | +}); |
| 24 | + |
| 25 | +it("renders a description with darkmode syntax highlighting", () => { |
| 26 | + const div = document.createElement("div"); |
| 27 | + ReactDOM.render(<MarkdownDescription uiSchema={{appBar: {"ui:darkMode": true}}} source={"```javascript\n\nconst foo = 'bar';\n\n```"}/>, div); |
| 28 | + expect(div.innerHTML).toContain("language-javascript"); |
| 29 | + ReactDOM.unmountComponentAtNode(div); |
| 30 | +}); |
| 31 | + |
| 32 | +it("renders a description that errors", () => { |
| 33 | + const div = document.createElement("div"); |
| 34 | + ReactDOM.render(<MarkdownDescription uiSchema={{}} source={"```"}/>, div); |
| 35 | + ReactDOM.unmountComponentAtNode(div); |
| 36 | +}); |
0 commit comments