@digabi/exam-engine-core 22.0.3 → 22.0.4-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. package/dist/__tests__/EditableGradingInstruction.test.d.ts +2 -0
  2. package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +1 -0
  3. package/dist/__tests__/EditableGradingInstruction.test.js +174 -0
  4. package/dist/__tests__/EditableGradingInstruction.test.js.map +1 -0
  5. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts +2 -0
  6. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts.map +1 -0
  7. package/dist/__tests__/EditableGradingInstructionLocalization.test.js +112 -0
  8. package/dist/__tests__/EditableGradingInstructionLocalization.test.js.map +1 -0
  9. package/dist/__tests__/FormatButton.test.d.ts +2 -0
  10. package/dist/__tests__/FormatButton.test.d.ts.map +1 -0
  11. package/dist/__tests__/FormatButton.test.js +94 -0
  12. package/dist/__tests__/FormatButton.test.js.map +1 -0
  13. package/dist/__tests__/annotations.test.js +7 -7
  14. package/dist/__tests__/annotations.test.js.map +1 -1
  15. package/dist/__tests__/editor/FormatButton.test.d.ts +2 -0
  16. package/dist/__tests__/editor/FormatButton.test.d.ts.map +1 -0
  17. package/dist/__tests__/editor/FormatButton.test.js +98 -0
  18. package/dist/__tests__/editor/FormatButton.test.js.map +1 -0
  19. package/dist/__tests__/editor/Formula.test.d.ts +2 -0
  20. package/dist/__tests__/editor/Formula.test.d.ts.map +1 -0
  21. package/dist/__tests__/editor/Formula.test.js +61 -0
  22. package/dist/__tests__/editor/Formula.test.js.map +1 -0
  23. package/dist/__tests__/editor/ImageUploadButton.test.d.ts +2 -0
  24. package/dist/__tests__/editor/ImageUploadButton.test.d.ts.map +1 -0
  25. package/dist/__tests__/editor/ImageUploadButton.test.js +94 -0
  26. package/dist/__tests__/editor/ImageUploadButton.test.js.map +1 -0
  27. package/dist/__tests__/editor/List.test.d.ts +2 -0
  28. package/dist/__tests__/editor/List.test.d.ts.map +1 -0
  29. package/dist/__tests__/editor/List.test.js +72 -0
  30. package/dist/__tests__/editor/List.test.js.map +1 -0
  31. package/dist/__tests__/editor/Table.test.d.ts +2 -0
  32. package/dist/__tests__/editor/Table.test.d.ts.map +1 -0
  33. package/dist/__tests__/editor/Table.test.js +172 -0
  34. package/dist/__tests__/editor/Table.test.js.map +1 -0
  35. package/dist/__tests__/editor/br.test.d.ts +2 -0
  36. package/dist/__tests__/editor/br.test.d.ts.map +1 -0
  37. package/dist/__tests__/editor/br.test.js +39 -0
  38. package/dist/__tests__/editor/br.test.js.map +1 -0
  39. package/dist/__tests__/editor/hr.test.d.ts +2 -0
  40. package/dist/__tests__/editor/hr.test.d.ts.map +1 -0
  41. package/dist/__tests__/editor/hr.test.js +39 -0
  42. package/dist/__tests__/editor/hr.test.js.map +1 -0
  43. package/dist/__tests__/editor/nbsp.test.d.ts +2 -0
  44. package/dist/__tests__/editor/nbsp.test.d.ts.map +1 -0
  45. package/dist/__tests__/editor/nbsp.test.js +55 -0
  46. package/dist/__tests__/editor/nbsp.test.js.map +1 -0
  47. package/dist/__tests__/editor/noWrap.test.d.ts +2 -0
  48. package/dist/__tests__/editor/noWrap.test.d.ts.map +1 -0
  49. package/dist/__tests__/editor/noWrap.test.js +62 -0
  50. package/dist/__tests__/editor/noWrap.test.js.map +1 -0
  51. package/dist/__tests__/editor/spanWithLang.test.d.ts +2 -0
  52. package/dist/__tests__/editor/spanWithLang.test.d.ts.map +1 -0
  53. package/dist/__tests__/editor/spanWithLang.test.js +38 -0
  54. package/dist/__tests__/editor/spanWithLang.test.js.map +1 -0
  55. package/dist/__tests__/editor/subSup.test.d.ts +2 -0
  56. package/dist/__tests__/editor/subSup.test.d.ts.map +1 -0
  57. package/dist/__tests__/editor/subSup.test.js +50 -0
  58. package/dist/__tests__/editor/subSup.test.js.map +1 -0
  59. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  60. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts +8 -0
  61. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts.map +1 -0
  62. package/dist/__tests__/utils/ProseMirrorWrapper.js +44 -0
  63. package/dist/__tests__/utils/ProseMirrorWrapper.js.map +1 -0
  64. package/dist/__tests__/utils/prosemirror.d.ts +2 -0
  65. package/dist/__tests__/utils/prosemirror.d.ts.map +1 -0
  66. package/dist/__tests__/utils/prosemirror.js +30 -0
  67. package/dist/__tests__/utils/prosemirror.js.map +1 -0
  68. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts +4 -0
  69. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts.map +1 -0
  70. package/dist/__tests__/utils/renderEditableGradingInstruction.js +22 -0
  71. package/dist/__tests__/utils/renderEditableGradingInstruction.js.map +1 -0
  72. package/dist/__tests__/utils/util.d.ts +2 -0
  73. package/dist/__tests__/utils/util.d.ts.map +1 -0
  74. package/dist/__tests__/utils/util.js +10 -0
  75. package/dist/__tests__/utils/util.js.map +1 -0
  76. package/dist/components/Localization.d.ts +5 -0
  77. package/dist/components/Localization.d.ts.map +1 -0
  78. package/dist/components/Localization.js +9 -0
  79. package/dist/components/Localization.js.map +1 -0
  80. package/dist/components/context/AnnotationProvider.d.ts +2 -2
  81. package/dist/components/context/AnnotationProvider.d.ts.map +1 -1
  82. package/dist/components/context/AnnotationProvider.js +3 -2
  83. package/dist/components/context/AnnotationProvider.js.map +1 -1
  84. package/dist/components/context/AttachmentContext.d.ts.map +1 -1
  85. package/dist/components/context/CommonExamContext.d.ts +1 -0
  86. package/dist/components/context/CommonExamContext.d.ts.map +1 -1
  87. package/dist/components/context/CommonExamContext.js +3 -0
  88. package/dist/components/context/CommonExamContext.js.map +1 -1
  89. package/dist/components/context/ExamContext.d.ts.map +1 -1
  90. package/dist/components/context/GradingInstructionContext.d.ts +17 -0
  91. package/dist/components/context/GradingInstructionContext.d.ts.map +1 -0
  92. package/dist/components/context/GradingInstructionContext.js +3 -0
  93. package/dist/components/context/GradingInstructionContext.js.map +1 -0
  94. package/dist/components/context/QuestionContext.d.ts.map +1 -1
  95. package/dist/components/context/ResultsContext.d.ts.map +1 -1
  96. package/dist/components/context/SectionContext.d.ts.map +1 -1
  97. package/dist/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
  98. package/dist/components/grading-instructions/AnswerGradingInstruction.js +7 -2
  99. package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
  100. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts +6 -0
  101. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -0
  102. package/dist/components/grading-instructions/EditableGradingInstruction.js +121 -0
  103. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -0
  104. package/dist/components/grading-instructions/GradingInstruction.d.ts +7 -0
  105. package/dist/components/grading-instructions/GradingInstruction.d.ts.map +1 -0
  106. package/dist/components/grading-instructions/GradingInstruction.js +9 -0
  107. package/dist/components/grading-instructions/GradingInstruction.js.map +1 -0
  108. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +4 -0
  109. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -0
  110. package/dist/components/grading-instructions/GradingInstructionProvider.js +7 -0
  111. package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -0
  112. package/dist/components/grading-instructions/GradingInstructions.d.ts +2 -1
  113. package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
  114. package/dist/components/grading-instructions/GradingInstructions.js +18 -15
  115. package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
  116. package/dist/components/grading-instructions/editor/AttributeToggleButton.d.ts +9 -0
  117. package/dist/components/grading-instructions/editor/AttributeToggleButton.d.ts.map +1 -0
  118. package/dist/components/grading-instructions/editor/AttributeToggleButton.js +53 -0
  119. package/dist/components/grading-instructions/editor/AttributeToggleButton.js.map +1 -0
  120. package/dist/components/grading-instructions/editor/CurrentElement.d.ts +2 -0
  121. package/dist/components/grading-instructions/editor/CurrentElement.d.ts.map +1 -0
  122. package/dist/components/grading-instructions/editor/CurrentElement.js +8 -0
  123. package/dist/components/grading-instructions/editor/CurrentElement.js.map +1 -0
  124. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts +7 -0
  125. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts.map +1 -0
  126. package/dist/components/grading-instructions/editor/CurrentLocalization.js +13 -0
  127. package/dist/components/grading-instructions/editor/CurrentLocalization.js.map +1 -0
  128. package/dist/components/grading-instructions/editor/FormatButton.d.ts +9 -0
  129. package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +1 -0
  130. package/dist/components/grading-instructions/editor/FormatButton.js +26 -0
  131. package/dist/components/grading-instructions/editor/FormatButton.js.map +1 -0
  132. package/dist/components/grading-instructions/editor/Formula.d.ts +15 -0
  133. package/dist/components/grading-instructions/editor/Formula.d.ts.map +1 -0
  134. package/dist/components/grading-instructions/editor/Formula.js +41 -0
  135. package/dist/components/grading-instructions/editor/Formula.js.map +1 -0
  136. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts +7 -0
  137. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts.map +1 -0
  138. package/dist/components/grading-instructions/editor/FormulaPopup.js +49 -0
  139. package/dist/components/grading-instructions/editor/FormulaPopup.js.map +1 -0
  140. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts +6 -0
  141. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts.map +1 -0
  142. package/dist/components/grading-instructions/editor/ImageUploadButton.js +77 -0
  143. package/dist/components/grading-instructions/editor/ImageUploadButton.js.map +1 -0
  144. package/dist/components/grading-instructions/editor/List.d.ts +9 -0
  145. package/dist/components/grading-instructions/editor/List.d.ts.map +1 -0
  146. package/dist/components/grading-instructions/editor/List.js +41 -0
  147. package/dist/components/grading-instructions/editor/List.js.map +1 -0
  148. package/dist/components/grading-instructions/editor/Localization.d.ts +3 -0
  149. package/dist/components/grading-instructions/editor/Localization.d.ts.map +1 -0
  150. package/dist/components/grading-instructions/editor/Localization.js +36 -0
  151. package/dist/components/grading-instructions/editor/Localization.js.map +1 -0
  152. package/dist/components/grading-instructions/editor/LocalizationButtons.d.ts +6 -0
  153. package/dist/components/grading-instructions/editor/LocalizationButtons.d.ts.map +1 -0
  154. package/dist/components/grading-instructions/editor/LocalizationButtons.js +14 -0
  155. package/dist/components/grading-instructions/editor/LocalizationButtons.js.map +1 -0
  156. package/dist/components/grading-instructions/editor/NBSP.d.ts +4 -0
  157. package/dist/components/grading-instructions/editor/NBSP.d.ts.map +1 -0
  158. package/dist/components/grading-instructions/editor/NBSP.js +17 -0
  159. package/dist/components/grading-instructions/editor/NBSP.js.map +1 -0
  160. package/dist/components/grading-instructions/editor/Table.d.ts +6 -0
  161. package/dist/components/grading-instructions/editor/Table.d.ts.map +1 -0
  162. package/dist/components/grading-instructions/editor/Table.js +186 -0
  163. package/dist/components/grading-instructions/editor/Table.js.map +1 -0
  164. package/dist/components/grading-instructions/editor/findNode.d.ts +3 -0
  165. package/dist/components/grading-instructions/editor/findNode.d.ts.map +1 -0
  166. package/dist/components/grading-instructions/editor/findNode.js +10 -0
  167. package/dist/components/grading-instructions/editor/findNode.js.map +1 -0
  168. package/dist/components/grading-instructions/editor/localizatio.d.ts +3 -0
  169. package/dist/components/grading-instructions/editor/localizatio.d.ts.map +1 -0
  170. package/dist/components/grading-instructions/editor/localizatio.js +36 -0
  171. package/dist/components/grading-instructions/editor/localizatio.js.map +1 -0
  172. package/dist/components/grading-instructions/editor/localizationSpan.d.ts +3 -0
  173. package/dist/components/grading-instructions/editor/localizationSpan.d.ts.map +1 -0
  174. package/dist/components/grading-instructions/editor/localizationSpan.js +36 -0
  175. package/dist/components/grading-instructions/editor/localizationSpan.js.map +1 -0
  176. package/dist/components/grading-instructions/editor/schemas/formulaSchema.d.ts +4 -0
  177. package/dist/components/grading-instructions/editor/schemas/formulaSchema.d.ts.map +1 -0
  178. package/dist/components/grading-instructions/editor/schemas/formulaSchema.js +62 -0
  179. package/dist/components/grading-instructions/editor/schemas/formulaSchema.js.map +1 -0
  180. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts +4 -0
  181. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts.map +1 -0
  182. package/dist/components/grading-instructions/editor/schemas/image-schema.js +47 -0
  183. package/dist/components/grading-instructions/editor/schemas/image-schema.js.map +1 -0
  184. package/dist/components/grading-instructions/editor/schemas/imageSchema.d.ts +4 -0
  185. package/dist/components/grading-instructions/editor/schemas/imageSchema.d.ts.map +1 -0
  186. package/dist/components/grading-instructions/editor/schemas/imageSchema.js +61 -0
  187. package/dist/components/grading-instructions/editor/schemas/imageSchema.js.map +1 -0
  188. package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts +72 -0
  189. package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts.map +1 -0
  190. package/dist/components/grading-instructions/editor/schemas/listSchema.js +7 -0
  191. package/dist/components/grading-instructions/editor/schemas/listSchema.js.map +1 -0
  192. package/dist/components/grading-instructions/editor/schemas/localizationSchema.d.ts +3 -0
  193. package/dist/components/grading-instructions/editor/schemas/localizationSchema.d.ts.map +1 -0
  194. package/dist/components/grading-instructions/editor/schemas/localizationSchema.js +39 -0
  195. package/dist/components/grading-instructions/editor/schemas/localizationSchema.js.map +1 -0
  196. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.d.ts +3 -0
  197. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.d.ts.map +1 -0
  198. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.js +19 -0
  199. package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.js.map +1 -0
  200. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.d.ts +3 -0
  201. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.d.ts.map +1 -0
  202. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js +19 -0
  203. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js.map +1 -0
  204. package/dist/components/grading-instructions/editor/schemas/subSupSchema.d.ts +3 -0
  205. package/dist/components/grading-instructions/editor/schemas/subSupSchema.d.ts.map +1 -0
  206. package/dist/components/grading-instructions/editor/schemas/subSupSchema.js +23 -0
  207. package/dist/components/grading-instructions/editor/schemas/subSupSchema.js.map +1 -0
  208. package/dist/components/grading-instructions/editor/schemas/tableSchema.d.ts +3 -0
  209. package/dist/components/grading-instructions/editor/schemas/tableSchema.d.ts.map +1 -0
  210. package/dist/components/grading-instructions/editor/schemas/tableSchema.js +43 -0
  211. package/dist/components/grading-instructions/editor/schemas/tableSchema.js.map +1 -0
  212. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts +3 -0
  213. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts.map +1 -0
  214. package/dist/components/grading-instructions/editor/spanWithNowrap.js +19 -0
  215. package/dist/components/grading-instructions/editor/spanWithNowrap.js.map +1 -0
  216. package/dist/components/grading-instructions/editor/spanWithPath.d.ts +3 -0
  217. package/dist/components/grading-instructions/editor/spanWithPath.d.ts.map +1 -0
  218. package/dist/components/grading-instructions/editor/spanWithPath.js +24 -0
  219. package/dist/components/grading-instructions/editor/spanWithPath.js.map +1 -0
  220. package/dist/components/grading-instructions/editor/util.d.ts +6 -0
  221. package/dist/components/grading-instructions/editor/util.d.ts.map +1 -0
  222. package/dist/components/grading-instructions/editor/util.js +10 -0
  223. package/dist/components/grading-instructions/editor/util.js.map +1 -0
  224. package/dist/components/shared/AnnotationMark.d.ts +1 -1
  225. package/dist/components/shared/AnnotationMark.d.ts.map +1 -1
  226. package/dist/components/shared/AnnotationPopup.d.ts +1 -1
  227. package/dist/components/shared/AnnotationPopup.d.ts.map +1 -1
  228. package/dist/components/shared/AnnotationPopup.js +11 -70
  229. package/dist/components/shared/AnnotationPopup.js.map +1 -1
  230. package/dist/components/shared/Popup.d.ts +15 -0
  231. package/dist/components/shared/Popup.d.ts.map +1 -0
  232. package/dist/components/shared/Popup.js +90 -0
  233. package/dist/components/shared/Popup.js.map +1 -0
  234. package/dist/components/shared/markText.d.ts +1 -1
  235. package/dist/components/shared/markText.d.ts.map +1 -1
  236. package/dist/components/shared/markText.js.map +1 -1
  237. package/dist/main-bundle.js +1 -1
  238. package/dist/main-bundle.js.LICENSE.txt +1 -1
  239. package/dist/main.css +1 -1
  240. package/package.json +11 -2
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ require("@testing-library/jest-dom");
8
+ const react_2 = require("@testing-library/react");
9
+ const ProseMirrorWrapper_1 = __importDefault(require("../utils/ProseMirrorWrapper"));
10
+ const prosemirror_1 = require("../utils/prosemirror");
11
+ const FormatButton_1 = __importDefault(require("../../src/components/grading-instructions/editor/FormatButton"));
12
+ const user_event_1 = __importDefault(require("@testing-library/user-event"));
13
+ const util_1 = require("../utils/util");
14
+ const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
15
+ const act = react_2.act;
16
+ describe('FormatButton', () => {
17
+ beforeAll(() => {
18
+ (0, prosemirror_1.mockCreateRange)();
19
+ });
20
+ afterEach(() => {
21
+ (0, react_2.cleanup)();
22
+ });
23
+ describe('Italics', () => {
24
+ it('Renders italics button', () => {
25
+ const props = { markName: 'em', icon: free_solid_svg_icons_1.faItalic };
26
+ const { button } = renderEditorWithFormatButton(props);
27
+ expect(button.children[0]).toHaveAttribute('data-icon', 'italic');
28
+ });
29
+ it('Toggles button active state when clicked', async () => {
30
+ const props = { markName: 'em', icon: free_solid_svg_icons_1.faItalic };
31
+ const { button } = renderEditorWithFormatButton(props);
32
+ expect(button).not.toHaveClass('active');
33
+ await user_event_1.default.click(button);
34
+ expect(button).toHaveClass('active');
35
+ await user_event_1.default.click(button);
36
+ expect(button).not.toHaveClass('active');
37
+ });
38
+ it('formats text', async () => {
39
+ const props = { markName: 'em', icon: free_solid_svg_icons_1.faItalic };
40
+ const { button, paragraph, container } = renderEditorWithFormatButton(props);
41
+ await user_event_1.default.click(button);
42
+ await act(async () => (0, util_1.insertText)(await container.findByRole('paragraph'), 'hello'));
43
+ expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('hello');
44
+ });
45
+ it('em tags are rendered as italic', () => {
46
+ const props = { markName: 'em', icon: free_solid_svg_icons_1.faItalic, innerHtml: '<em>Italic text</em>' };
47
+ const { paragraph } = renderEditorWithFormatButton(props);
48
+ expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('Italic text');
49
+ });
50
+ it('i tags are rendered as italic', () => {
51
+ const props = { markName: 'em', icon: free_solid_svg_icons_1.faItalic, innerHtml: '<i>Italic text</i>' };
52
+ const { paragraph } = renderEditorWithFormatButton(props);
53
+ expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('Italic text');
54
+ });
55
+ });
56
+ describe('Bold', () => {
57
+ it('Renders bold button', () => {
58
+ const props = { markName: 'strong', icon: free_solid_svg_icons_1.faBold };
59
+ const { button } = renderEditorWithFormatButton(props);
60
+ expect(button.children[0]).toHaveAttribute('data-icon', 'bold');
61
+ });
62
+ it('Toggles button active state when clicked', async () => {
63
+ const props = { markName: 'strong', icon: free_solid_svg_icons_1.faBold };
64
+ const { button } = renderEditorWithFormatButton(props);
65
+ expect(button).not.toHaveClass('active');
66
+ await user_event_1.default.click(button);
67
+ expect(button).toHaveClass('active');
68
+ await user_event_1.default.click(button);
69
+ expect(button).not.toHaveClass('active');
70
+ });
71
+ it('formats text', async () => {
72
+ const props = { markName: 'strong', icon: free_solid_svg_icons_1.faBold };
73
+ const { button, container, paragraph } = renderEditorWithFormatButton(props);
74
+ await user_event_1.default.click(button);
75
+ await act(async () => {
76
+ (0, util_1.insertText)(await container.findByRole('paragraph'), 'hello');
77
+ });
78
+ expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('hello');
79
+ });
80
+ it('b tags are rendered as bold', () => {
81
+ const props = { markName: 'strong', icon: free_solid_svg_icons_1.faBold, innerHtml: '<b>Bold text</b>' };
82
+ const { paragraph } = renderEditorWithFormatButton(props);
83
+ expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('Bold text');
84
+ });
85
+ it('strong tags are rendered as bold', () => {
86
+ const props = { markName: 'strong', icon: free_solid_svg_icons_1.faBold, innerHtml: '<strong>Bold text</strong>' };
87
+ const { paragraph } = renderEditorWithFormatButton(props);
88
+ expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('Bold text');
89
+ });
90
+ });
91
+ function renderEditorWithFormatButton(props) {
92
+ const { markName, icon, innerHtml = '' } = props;
93
+ const container = (0, react_2.render)(react_1.default.createElement(ProseMirrorWrapper_1.default, { innerHtml: innerHtml },
94
+ react_1.default.createElement(FormatButton_1.default, { markName: markName, icon: icon })));
95
+ return { button: container.getByRole('button'), paragraph: container.getByRole('paragraph'), container };
96
+ }
97
+ });
98
+ //# sourceMappingURL=FormatButton.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormatButton.test.js","sourceRoot":"","sources":["../../../__tests__/editor/FormatButton.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,qCAAkC;AAClC,kDAAgF;AAChF,qFAA4D;AAC5D,sDAAsD;AACtD,iHAAwF;AACxF,6EAAmD;AACnD,wCAA0C;AAE1C,4EAAoE;AAEpE,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,6BAAe,GAAE,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,eAAO,GAAE,CAAA;IACX,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,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CAAC;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Formula.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/Formula.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const util_1 = require("../utils/util");
7
+ const act = react_1.act;
8
+ describe('Editor - Formula', () => {
9
+ let cleanup;
10
+ let onContentChangeMock;
11
+ beforeEach(() => {
12
+ onContentChangeMock = jest.fn();
13
+ });
14
+ afterEach(() => {
15
+ if (cleanup) {
16
+ cleanup();
17
+ }
18
+ cleanup = null;
19
+ });
20
+ it('Formula is rendered as expected', () => {
21
+ const inputData = '<p>bar <e:formula data-editor-id="e-formula">foo</e:formula></p>';
22
+ const expectedOutput = '<p>bar <img alt="foo" formula="true" src="/math.svg?latex=foo"><img class="ProseMirror-separator" alt=""><br class="ProseMirror-trailingBreak"></p>';
23
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
24
+ const table = result.container.querySelector('.ProseMirror');
25
+ expect(table.innerHTML).toBe(expectedOutput);
26
+ });
27
+ it('Change in content causes formula to be returned as expected', async () => {
28
+ cleanup = (0, prosemirror_1.mockCreateRange)();
29
+ const inputData = '<p>bar</p><p><e:formula data-editor-id="e-formula" mode="inline">foo</e:formula><e:formula data-editor-id="e-formula" assistive-title="foobar">bar</e:formula></p>';
30
+ const expectedOutput = '<p>foo</p><p><e:formula mode="inline">foo</e:formula><e:formula assistive-title="foobar">bar</e:formula></p>';
31
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
32
+ await act(async () => {
33
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
34
+ });
35
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
36
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
37
+ });
38
+ it('assistive-tile supports < and > characters correctly', async () => {
39
+ cleanup = (0, prosemirror_1.mockCreateRange)();
40
+ const inputData = '<p>bar</p><p><e:formula data-editor-id="e-formula" assistive-title="foobar > 0 < x">bar</e:formula></p>';
41
+ const expectedOutput = '<p>foo</p><p><e:formula assistive-title="foobar &gt; 0 &lt; x">bar</e:formula></p>';
42
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
43
+ await act(async () => {
44
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
45
+ });
46
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
47
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
48
+ });
49
+ it('Empty formula is removed when sending changed content', async () => {
50
+ cleanup = (0, prosemirror_1.mockCreateRange)();
51
+ const inputData = '<p>bar</p><p><e:formula data-editor-id="e-formula"></e:formula></p>';
52
+ const expectedOutput = '<p>foo</p><p></p>';
53
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
54
+ await act(async () => {
55
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
56
+ });
57
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
58
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
59
+ });
60
+ });
61
+ //# sourceMappingURL=Formula.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formula.test.js","sourceRoot":"","sources":["../../../__tests__/editor/Formula.test.tsx"],"names":[],"mappings":";;AAAA,kDAAuD;AACvD,sDAAsD;AACtD,gGAAoF;AACpF,wCAA0C;AAE1C,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,OAA4B,CA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est-dom';
2
+ //# sourceMappingURL=ImageUploadButton.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUploadButton.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/ImageUploadButton.test.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAA"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ require("@testing-library/jest-dom");
7
+ const react_1 = require("@testing-library/react");
8
+ const prosemirror_1 = require("../utils/prosemirror");
9
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
10
+ const user_event_1 = __importDefault(require("@testing-library/user-event"));
11
+ const util_1 = require("../utils/util");
12
+ const prosemirror_view_1 = require("prosemirror-view");
13
+ jest.spyOn(prosemirror_view_1.EditorView.prototype, 'focus').mockImplementation(() => { });
14
+ const act = react_1.act;
15
+ describe('ImageUploadButton', () => {
16
+ let onContentChangeMock;
17
+ const mockedTempUrl = 'mocked-temp-url';
18
+ beforeEach(() => {
19
+ onContentChangeMock = jest.fn();
20
+ });
21
+ beforeAll(() => {
22
+ (0, prosemirror_1.mockCreateRange)();
23
+ global.URL.createObjectURL = jest.fn(() => mockedTempUrl);
24
+ File.prototype.arrayBuffer = jest.fn().mockResolvedValue(new ArrayBuffer(8));
25
+ });
26
+ afterEach(() => {
27
+ (0, react_1.cleanup)();
28
+ });
29
+ describe('Renders Image', () => {
30
+ const htmlAttrs = {
31
+ width: '504',
32
+ height: '504',
33
+ class: 'foo',
34
+ lang: 'fi-FI',
35
+ src: `/${renderEditableGradingInstruction_1.mockedResolvedPath}/foo.bar`
36
+ };
37
+ const xmlAttrs = {
38
+ lang: htmlAttrs.lang,
39
+ class: htmlAttrs.class,
40
+ src: 'foo.bar'
41
+ };
42
+ it('e:image tag is rendered in and out with correct attributes and tags', async () => {
43
+ const container = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(`<div><p>hello</p><e:image data-editor-id="e-image" width=${htmlAttrs.width} height=${htmlAttrs.height} lang=${htmlAttrs.lang} class=${htmlAttrs.class} src=${xmlAttrs.src}></e:image></div>`, onContentChangeMock);
44
+ const image = container.getByRole('img');
45
+ for (const [key, value] of Object.entries(htmlAttrs)) {
46
+ expect(image).toHaveAttribute(key, value);
47
+ }
48
+ await act(async () => {
49
+ (0, util_1.insertText)(await container.findByText('hello'), 'hello world');
50
+ });
51
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
52
+ expect(onContentChangeMock).toHaveBeenCalledWith(`<p>hello world</p><p><e:image lang="${xmlAttrs.lang}" class="${xmlAttrs.class}" src="${xmlAttrs.src}"></e:image></p>`, '');
53
+ });
54
+ it('image can be uploaded', async () => {
55
+ const container = (0, renderEditableGradingInstruction_1.renderGradingInstruction)('', onContentChangeMock);
56
+ const file = new File(['hello'], 'hello.png', { type: 'image/png' });
57
+ const input = container.queryByTestId('image-upload-input');
58
+ await user_event_1.default.upload(input, file);
59
+ await (0, react_1.waitFor)(() => {
60
+ expect(onContentChangeMock).toHaveBeenCalledTimes(2);
61
+ expect(onContentChangeMock).toHaveBeenNthCalledWith(1, `<p><e:image src="${mockedTempUrl}"></e:image></p>`, '');
62
+ expect(onContentChangeMock).toHaveBeenNthCalledWith(2, `<p><e:image src="${renderEditableGradingInstruction_1.mockedPermanentUrl}"></e:image></p>`, '');
63
+ const image = container.getByRole('img');
64
+ expect(image).toHaveAttribute('src', `/${renderEditableGradingInstruction_1.mockedResolvedPath}/${renderEditableGradingInstruction_1.mockedPermanentUrl}`);
65
+ });
66
+ });
67
+ it('e:image-title tag is rendered in and out with correct attributes and tags', async () => {
68
+ const imageTitle = { default: 'Image title text', fi: 'title fi', sv: 'title sv' };
69
+ const container = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(`<div>
70
+ <p>hello</p>
71
+ <e:image data-editor-id="e-image" width=${htmlAttrs.width} height=${htmlAttrs.height} lang=${htmlAttrs.lang} class=${htmlAttrs.class} src=${xmlAttrs.src}>
72
+ <e:image-title data-editor-id="e-image-title">
73
+ ${imageTitle.default}
74
+ <span lang="fi-FI" exam-type="hearing-impaired" data-editor-id="e-localization-inline">${imageTitle.fi}</span>
75
+ <span lang="sv-FI" exam-type="hearing-impaired" data-editor-id="e-localization-inline">${imageTitle.sv}</span>
76
+ </e:image-title>
77
+ </e:image>
78
+ </div>`, onContentChangeMock);
79
+ const figure = container.getByRole('figure');
80
+ for (const [key, value] of Object.entries(htmlAttrs)) {
81
+ expect((0, react_1.within)(figure).getByRole('img')).toHaveAttribute(key, value);
82
+ }
83
+ expect(figure.querySelector('figcaption')).toHaveTextContent(`${imageTitle.default} ${imageTitle.fi} ${imageTitle.sv}`);
84
+ expect(figure.querySelector('figcaption [lang="fi-FI"]')).toHaveTextContent(imageTitle.fi);
85
+ expect(figure.querySelector('figcaption [lang="sv-FI"]')).toHaveTextContent(imageTitle.sv);
86
+ await act(async () => {
87
+ (0, util_1.insertText)(await container.findByText('hello'), 'hello world');
88
+ });
89
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
90
+ expect(onContentChangeMock).toHaveBeenCalledWith(`<p>hello world</p><p><e:image lang="${xmlAttrs.lang}" class="${xmlAttrs.class}" src="${xmlAttrs.src}"><e:image-title>${imageTitle.default} <e:localization lang="fi-FI" exam-type="hearing-impaired">${imageTitle.fi}</e:localization> <e:localization lang="sv-FI" exam-type="hearing-impaired">${imageTitle.sv}</e:localization></e:image-title></e:image></p>`, '');
91
+ });
92
+ });
93
+ });
94
+ //# sourceMappingURL=ImageUploadButton.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUploadButton.test.js","sourceRoot":"","sources":["../../../__tests__/editor/ImageUploadButton.test.tsx"],"names":[],"mappings":";;;;;AAAA,qCAAkC;AAClC,kDAAiF;AACjF,sDAAsD;AACtD,gGAIkD;AAClD,6EAAmD;AACnD,wCAA0C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C,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YACrE,CAAC;YACD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAC1D,GAAG,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,EAAE,IAAI,UAAU,CAAC,EAAE,EAAE,CAC1D,CAAA;YACD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,2BAA2B,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;YAC1F,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,2BAA2B,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;YAE1F,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;gBACnB,IAAA,iBAAU,EAAC,MAAM,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAA;YAChE,CAAC,CAAC,CAAA;YAEF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;YACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAC9C,uCAAuC,QAAQ,CAAC,IAAI,YAAY,QAAQ,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAG,oBAAoB,UAAU,CAAC,OAAO,8DAA8D,UAAU,CAAC,EAAE,+EAA+E,UAAU,CAAC,EAAE,iDAAiD,EAClW,EAAE,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=List.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/List.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = require("@testing-library/react");
7
+ const prosemirror_1 = require("../utils/prosemirror");
8
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
9
+ const user_event_1 = __importDefault(require("@testing-library/user-event"));
10
+ const util_1 = require("../utils/util");
11
+ const act = react_1.act;
12
+ describe('Editor - List', () => {
13
+ let cleanup;
14
+ let onContentChangeMock;
15
+ beforeEach(() => {
16
+ onContentChangeMock = jest.fn();
17
+ });
18
+ afterEach(() => {
19
+ if (cleanup) {
20
+ cleanup();
21
+ }
22
+ cleanup = null;
23
+ });
24
+ it('Bullet list is rendered as expected', () => {
25
+ const inputData = '<p>bar</p><ul><li>foo</li></ul>';
26
+ const expectedDom = '<p>bar</p><ul><li><p>foo</p></li></ul>';
27
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
28
+ const table = result.container.querySelector('.ProseMirror');
29
+ expect(table.innerHTML).toBe(expectedDom);
30
+ });
31
+ it('Ordered list is rendered as expected', () => {
32
+ const inputData = '<p>bar</p><ol><li>foo</li></ol>';
33
+ const expectedDom = '<p>bar</p><ol><li><p>foo</p></li></ol>';
34
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
35
+ const table = result.container.querySelector('.ProseMirror');
36
+ expect(table.innerHTML).toBe(expectedDom);
37
+ });
38
+ it('Change in content causes bullet list to be returned as expected', async () => {
39
+ cleanup = (0, prosemirror_1.mockCreateRange)();
40
+ const inputData = '<p>bar</p><ul><li>foo</li></ul>';
41
+ const expectedOutput = '<p>foo</p><ul><li><p>foo</p></li></ul>';
42
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
43
+ await act(async () => {
44
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
45
+ });
46
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
47
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
48
+ });
49
+ it('Change in content causes ordered list to be returned as expected', async () => {
50
+ cleanup = (0, prosemirror_1.mockCreateRange)();
51
+ const inputData = '<p>bar</p><ol><li>foo</li></ol>';
52
+ const expectedOutput = '<p>foo</p><ol><li><p>foo</p></li></ol>';
53
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
54
+ await act(async () => {
55
+ (0, util_1.insertText)(await result.findByText('bar'), 'foo');
56
+ });
57
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
58
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
59
+ });
60
+ it('Insert bullet list adds expected string', async () => {
61
+ cleanup = (0, prosemirror_1.mockCreateRange)();
62
+ const inputData = '<p>foo</p><p>bar</p>';
63
+ const expectedOutput = '<p></p><ul><li><p></p></li></ul><p>foo</p><p>bar</p>';
64
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
65
+ await act(async () => {
66
+ await user_event_1.default.click(await result.findByTestId('editor-menu-add-bullet_list'));
67
+ });
68
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
69
+ expect(onContentChangeMock).toHaveBeenLastCalledWith(expectedOutput, '');
70
+ });
71
+ });
72
+ //# sourceMappingURL=List.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.test.js","sourceRoot":"","sources":["../../../__tests__/editor/List.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAuD;AACvD,sDAAsD;AACtD,gGAAoF;AACpF,6EAAmD;AACnD,wCAA0C;AAE1C,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,I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AC,MAAM,MAAM,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC,CAAA;QACjF,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,wBAAwB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=Table.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/Table.test.tsx"],"names":[],"mappings":"AAIA,OAAO,2BAA2B,CAAA"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = require("@testing-library/react");
7
+ const user_event_1 = __importDefault(require("@testing-library/user-event"));
8
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
9
+ const util_1 = require("../utils/util");
10
+ require("@testing-library/jest-dom");
11
+ const act = react_1.act;
12
+ describe('Table', () => {
13
+ let cleanup;
14
+ let onContentChangeMock;
15
+ beforeEach(() => {
16
+ onContentChangeMock = jest.fn();
17
+ });
18
+ afterEach(() => {
19
+ if (cleanup) {
20
+ cleanup();
21
+ }
22
+ cleanup = null;
23
+ });
24
+ it('Table is rendered as expected', () => {
25
+ const inputData = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
26
+ const expectedOutput = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
27
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
28
+ const table = result.container.querySelector('.ProseMirror');
29
+ expect(table.innerHTML).toBe(expectedOutput);
30
+ });
31
+ it('Change in table is returned as expected', async () => {
32
+ cleanup = mockCreateRange();
33
+ const inputData = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
34
+ const expectedOutput = '<table class="e-table"><tbody><tr><td>bar</td></tr></tbody></table>';
35
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
36
+ await act(async () => {
37
+ (0, util_1.insertText)(await result.findByText('foo'), 'bar');
38
+ });
39
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
40
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
41
+ });
42
+ it('Insert table adds expected table', async () => {
43
+ const inputData = '';
44
+ const expectedOutput = '<table class="e-table e-width-half"><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table>';
45
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
46
+ await act(async () => {
47
+ await user_event_1.default.click(await result.findByTestId('editor-menu-add-table'));
48
+ });
49
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
50
+ });
51
+ it('Remove table removes table', async () => {
52
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
53
+ const expectedOutput = '<p></p>';
54
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
55
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista taulukko');
56
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
57
+ });
58
+ it('Insert column adds column', async () => {
59
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
60
+ const expectedOutput = '<table><tbody><tr><td>foo</td><td></td></tr></tbody></table>';
61
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
62
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää sarake');
63
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
64
+ });
65
+ it('Remove column removes column', async () => {
66
+ const inputData = '<table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></table>';
67
+ const expectedOutput = '<table><tbody><tr><td>bar</td></tr></tbody></table>';
68
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
69
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista sarake');
70
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
71
+ });
72
+ it('Insert row adds row', async () => {
73
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
74
+ const expectedOutput = '<table><tbody><tr><td>foo</td></tr><tr><td></td></tr></tbody></table>';
75
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
76
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää rivi');
77
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
78
+ });
79
+ it('Remove row removes row', async () => {
80
+ const inputData = '<table><tbody><tr><td>foo</td></tr><tr><td>bar</td></tr></tbody></table>';
81
+ const expectedOutput = '<table><tbody><tr><td>bar</td></tr></tbody></table>';
82
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
83
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista rivi');
84
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
85
+ });
86
+ it('Full width changes full width class to table', async () => {
87
+ const inputData = '<table class="e-width-half"><tbody><tr><td>foo</td></tr></tbody></table>';
88
+ const expectedOutput = '<table class="e-width-full"><tbody><tr><td>foo</td></tr></tbody></table>';
89
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
90
+ expect(result.queryByText('Puolikas leveys')).not.toBeInTheDocument();
91
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Täysi leveys');
92
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
93
+ });
94
+ it('Half width changes half width class to table', async () => {
95
+ const inputData = '<table class="e-width-full"><tbody><tr><td>foo</td></tr></tbody></table>';
96
+ const expectedOutput = '<table class="e-width-half"><tbody><tr><td>foo</td></tr></tbody></table>';
97
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
98
+ expect(result.queryByText('Täysi leveys')).not.toBeInTheDocument();
99
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Puolikas leveys');
100
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
101
+ });
102
+ it('Remove borders adds e-table--borderless class to table', async () => {
103
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
104
+ const expectedOutput = '<table class="e-table--borderless"><tbody><tr><td>foo</td></tr></tbody></table>';
105
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
106
+ expect(result.queryByText('Lisää reunat')).not.toBeInTheDocument();
107
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista reunat');
108
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
109
+ });
110
+ it('Add borders removes e-table--borderless class from table', async () => {
111
+ const inputData = '<table class="e-table--borderless"><tbody><tr><td>foo</td></tr></tbody></table>';
112
+ const expectedOutput = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
113
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
114
+ expect(result.queryByText('Poista reunat')).not.toBeInTheDocument();
115
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää reunat');
116
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
117
+ });
118
+ it('Remove zebra removes class from table', async () => {
119
+ const inputData = '<table class="e-table--zebra"><tbody><tr><td>foo</td></tr></tbody></table>';
120
+ const expectedOutput = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
121
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
122
+ expect(result.queryByText('Lisää raidat')).not.toBeInTheDocument();
123
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista raidat');
124
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
125
+ });
126
+ it('Add zebra adds e-table--zebra class to table', async () => {
127
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
128
+ const expectedOutput = '<table class="e-table--zebra"><tbody><tr><td>foo</td></tr></tbody></table>';
129
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
130
+ expect(result.queryByText('Poista raidat')).not.toBeInTheDocument();
131
+ await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää raidat');
132
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
133
+ });
134
+ });
135
+ async function clickTableMenuButtonWithFocusOnCell(result, cellText, buttonText) {
136
+ await act(async () => {
137
+ await focusOnTablesCell(result, cellText);
138
+ await user_event_1.default.click(await result.findByText(buttonText));
139
+ });
140
+ }
141
+ async function focusOnTablesCell(result, text) {
142
+ // Replace cell's text with same text
143
+ // Hack to get focus on cell without need to mock createRange
144
+ (0, util_1.insertText)(await result.findByText(text), text);
145
+ }
146
+ function mockCreateRange() {
147
+ const originalCreateRange = global.window.document.createRange;
148
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
149
+ // @ts-expect-error
150
+ global.Range = function Range() { };
151
+ const createContextualFragment = (html) => {
152
+ const div = document.createElement('div');
153
+ div.innerHTML = html;
154
+ return div.children[0];
155
+ };
156
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
157
+ // @ts-expect-error
158
+ Range.prototype.createContextualFragment = (html) => createContextualFragment(html);
159
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
160
+ // @ts-expect-error
161
+ global.window.document.createRange = function createRange() {
162
+ return {
163
+ setEnd: () => { },
164
+ setStart: () => { },
165
+ getBoundingClientRect: () => ({ right: 0 }),
166
+ getClientRects: () => [],
167
+ createContextualFragment
168
+ };
169
+ };
170
+ return () => (global.window.document.createRange = originalCreateRange);
171
+ }
172
+ //# sourceMappingURL=Table.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.test.js","sourceRoot":"","sources":["../../../__tests__/editor/Table.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAqE;AACrE,6EAAmD;AACnD,gGAAoF;AACpF,wCAA0C;AAC1C,qCAAkC;AAElC,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,SAAS,GAAG,qEAAqE,CAAA;QACvF,MAAM,cAAc,GAAG,qEAAqE,CAAA;QAC5F,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,CAAC,CAAA;QAClD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAC5D,MAAM,CAAC,KAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC/C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACvD,OAAO,GAAG,eAAe,EAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,qEAAqE,CAAA;QACvF,MAAM,cAAc,GAAG,qEAAqE,CAAA;QAC5F,MAAM,MAAM,GAAG,IAAA,2DAA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