@madie/madie-design-system 1.2.64 → 1.2.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/RichTextEditor/index.jsx +1 -0
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components/_rich-text-editor.scss +5 -0
- package/styles/qppds/components/_rich-text-editor.scss +4 -0
- package/test/components/RichTextEditor.test.js +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
|
|
3
3
|
import RichTextEditor from "../../components/RichTextEditor/index";
|
|
4
|
+
import DOMPurify from "dompurify";
|
|
4
5
|
|
|
5
6
|
describe("RichTextEditor Component", () => {
|
|
6
7
|
const mockOnChange = jest.fn();
|
|
@@ -88,4 +89,28 @@ describe("RichTextEditor Component", () => {
|
|
|
88
89
|
expect(editorContent).toBeInTheDocument();
|
|
89
90
|
expect(editorContent).toHaveTextContent("Safe Content");
|
|
90
91
|
});
|
|
92
|
+
|
|
93
|
+
it("test renders sanitized content with preserved whitespace when readOnly is true", () => {
|
|
94
|
+
const content = `this is a statement
|
|
95
|
+
this is a statement
|
|
96
|
+
this is a statement
|
|
97
|
+
|
|
98
|
+
---------------------
|
|
99
|
+
this is a statement`;
|
|
100
|
+
|
|
101
|
+
render(
|
|
102
|
+
<RichTextEditor
|
|
103
|
+
id="test-editor"
|
|
104
|
+
label="Test Label"
|
|
105
|
+
content={content}
|
|
106
|
+
onChange={mockOnChange}
|
|
107
|
+
readOnly
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const readOnlyContent = screen.getByTestId("test-editor-value");
|
|
112
|
+
|
|
113
|
+
// Ensure the innerHTML matches the sanitized version of the content
|
|
114
|
+
expect(readOnlyContent.innerHTML).toBe(DOMPurify.sanitize(content));
|
|
115
|
+
});
|
|
91
116
|
});
|