@digabi/exam-engine-core 22.1.7-alpha.1 → 22.2.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. package/dist/__tests__/annotations.test.js +4 -3
  2. package/dist/__tests__/annotations.test.js.map +1 -1
  3. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  4. package/dist/components/context/AttachmentContext.d.ts.map +1 -1
  5. package/dist/components/context/ExamContext.d.ts.map +1 -1
  6. package/dist/components/context/GradingInstructionContext.d.ts +6 -11
  7. package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
  8. package/dist/components/context/GradingInstructionContext.js.map +1 -1
  9. package/dist/components/context/QuestionContext.d.ts.map +1 -1
  10. package/dist/components/context/ResultsContext.d.ts.map +1 -1
  11. package/dist/components/context/SectionContext.d.ts.map +1 -1
  12. package/dist/components/exam/RichTextAnswer.d.ts +2 -9
  13. package/dist/components/exam/RichTextAnswer.d.ts.map +1 -1
  14. package/dist/components/exam/RichTextAnswer.js +14 -33
  15. package/dist/components/exam/RichTextAnswer.js.map +1 -1
  16. package/dist/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
  17. package/dist/components/grading-instructions/AnswerGradingInstruction.js +4 -3
  18. package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
  19. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +1 -1
  20. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -1
  21. package/dist/components/grading-instructions/GradingInstructionProvider.js +1 -4
  22. package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
  23. package/dist/components/grading-instructions/GradingInstructions.d.ts +6 -2
  24. package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
  25. package/dist/components/grading-instructions/GradingInstructions.js +2 -3
  26. package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
  27. package/dist/components/shared/Popup.d.ts +0 -1
  28. package/dist/components/shared/Popup.d.ts.map +1 -1
  29. package/dist/components/shared/Popup.js +14 -27
  30. package/dist/components/shared/Popup.js.map +1 -1
  31. package/dist/dom-utils.d.ts.map +1 -1
  32. package/dist/dom-utils.js +4 -2
  33. package/dist/dom-utils.js.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +1 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/main-bundle.js +356 -1
  39. package/dist/main-bundle.js.LICENSE.txt +11 -1
  40. package/dist/main.css +1 -1
  41. package/package.json +5 -14
  42. package/dist/__tests__/EditableGradingInsatruction.test.d.ts +0 -1
  43. package/dist/__tests__/EditableGradingInsatruction.test.d.ts.map +0 -1
  44. package/dist/__tests__/EditableGradingInsatruction.test.js +0 -2
  45. package/dist/__tests__/EditableGradingInsatruction.test.js.map +0 -1
  46. package/dist/__tests__/EditableGradingInstruction.test.d.ts +0 -2
  47. package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +0 -1
  48. package/dist/__tests__/EditableGradingInstruction.test.js +0 -174
  49. package/dist/__tests__/EditableGradingInstruction.test.js.map +0 -1
  50. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts +0 -2
  51. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts.map +0 -1
  52. package/dist/__tests__/EditableGradingInstructionLocalization.test.js +0 -75
  53. package/dist/__tests__/EditableGradingInstructionLocalization.test.js.map +0 -1
  54. package/dist/__tests__/FormatButton.test.d.ts +0 -2
  55. package/dist/__tests__/FormatButton.test.d.ts.map +0 -1
  56. package/dist/__tests__/FormatButton.test.js +0 -94
  57. package/dist/__tests__/FormatButton.test.js.map +0 -1
  58. package/dist/__tests__/editor/FormatButton.test.d.ts +0 -2
  59. package/dist/__tests__/editor/FormatButton.test.d.ts.map +0 -1
  60. package/dist/__tests__/editor/FormatButton.test.js +0 -98
  61. package/dist/__tests__/editor/FormatButton.test.js.map +0 -1
  62. package/dist/__tests__/editor/Formula.test.d.ts +0 -2
  63. package/dist/__tests__/editor/Formula.test.d.ts.map +0 -1
  64. package/dist/__tests__/editor/Formula.test.js +0 -50
  65. package/dist/__tests__/editor/Formula.test.js.map +0 -1
  66. package/dist/__tests__/editor/ImageUploadButton.test.d.ts +0 -2
  67. package/dist/__tests__/editor/ImageUploadButton.test.d.ts.map +0 -1
  68. package/dist/__tests__/editor/ImageUploadButton.test.js +0 -69
  69. package/dist/__tests__/editor/ImageUploadButton.test.js.map +0 -1
  70. package/dist/__tests__/editor/List.test.d.ts +0 -2
  71. package/dist/__tests__/editor/List.test.d.ts.map +0 -1
  72. package/dist/__tests__/editor/List.test.js +0 -72
  73. package/dist/__tests__/editor/List.test.js.map +0 -1
  74. package/dist/__tests__/editor/NBSP.test.d.ts +0 -2
  75. package/dist/__tests__/editor/NBSP.test.d.ts.map +0 -1
  76. package/dist/__tests__/editor/NBSP.test.js +0 -55
  77. package/dist/__tests__/editor/NBSP.test.js.map +0 -1
  78. package/dist/__tests__/editor/Table.test.d.ts +0 -2
  79. package/dist/__tests__/editor/Table.test.d.ts.map +0 -1
  80. package/dist/__tests__/editor/Table.test.js +0 -172
  81. package/dist/__tests__/editor/Table.test.js.map +0 -1
  82. package/dist/__tests__/editor/br.test.d.ts +0 -2
  83. package/dist/__tests__/editor/br.test.d.ts.map +0 -1
  84. package/dist/__tests__/editor/br.test.js +0 -39
  85. package/dist/__tests__/editor/br.test.js.map +0 -1
  86. package/dist/__tests__/editor/hr.test.d.ts +0 -2
  87. package/dist/__tests__/editor/hr.test.d.ts.map +0 -1
  88. package/dist/__tests__/editor/hr.test.js +0 -39
  89. package/dist/__tests__/editor/hr.test.js.map +0 -1
  90. package/dist/__tests__/editor/no-wrap.test.d.ts +0 -2
  91. package/dist/__tests__/editor/no-wrap.test.d.ts.map +0 -1
  92. package/dist/__tests__/editor/no-wrap.test.js +0 -43
  93. package/dist/__tests__/editor/no-wrap.test.js.map +0 -1
  94. package/dist/__tests__/editor/noWrap.test.d.ts +0 -2
  95. package/dist/__tests__/editor/noWrap.test.d.ts.map +0 -1
  96. package/dist/__tests__/editor/noWrap.test.js +0 -62
  97. package/dist/__tests__/editor/noWrap.test.js.map +0 -1
  98. package/dist/__tests__/utils/EditableGradingInstructionsWrapper.d.ts +0 -1
  99. package/dist/__tests__/utils/EditableGradingInstructionsWrapper.d.ts.map +0 -1
  100. package/dist/__tests__/utils/EditableGradingInstructionsWrapper.js +0 -2
  101. package/dist/__tests__/utils/EditableGradingInstructionsWrapper.js.map +0 -1
  102. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts +0 -8
  103. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts.map +0 -1
  104. package/dist/__tests__/utils/ProseMirrorWrapper.js +0 -44
  105. package/dist/__tests__/utils/ProseMirrorWrapper.js.map +0 -1
  106. package/dist/__tests__/utils/prosemirror.d.ts +0 -2
  107. package/dist/__tests__/utils/prosemirror.d.ts.map +0 -1
  108. package/dist/__tests__/utils/prosemirror.js +0 -30
  109. package/dist/__tests__/utils/prosemirror.js.map +0 -1
  110. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts +0 -4
  111. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts.map +0 -1
  112. package/dist/__tests__/utils/renderEditableGradingInstruction.js +0 -22
  113. package/dist/__tests__/utils/renderEditableGradingInstruction.js.map +0 -1
  114. package/dist/__tests__/utils/renderEditableGradingInstructions.d.ts +0 -1
  115. package/dist/__tests__/utils/renderEditableGradingInstructions.d.ts.map +0 -1
  116. package/dist/__tests__/utils/renderEditableGradingInstructions.js +0 -2
  117. package/dist/__tests__/utils/renderEditableGradingInstructions.js.map +0 -1
  118. package/dist/__tests__/utils/util.d.ts +0 -2
  119. package/dist/__tests__/utils/util.d.ts.map +0 -1
  120. package/dist/__tests__/utils/util.js +0 -10
  121. package/dist/__tests__/utils/util.js.map +0 -1
  122. package/dist/components/LexicalEditor.d.ts +0 -3
  123. package/dist/components/LexicalEditor.d.ts.map +0 -1
  124. package/dist/components/LexicalEditor.js +0 -44
  125. package/dist/components/LexicalEditor.js.map +0 -1
  126. package/dist/components/RTE.d.ts +0 -3
  127. package/dist/components/RTE.d.ts.map +0 -1
  128. package/dist/components/RTE.js +0 -23
  129. package/dist/components/RTE.js.map +0 -1
  130. package/dist/components/TablePlugin.d.ts +0 -1
  131. package/dist/components/TablePlugin.d.ts.map +0 -1
  132. package/dist/components/TablePlugin.js +0 -2
  133. package/dist/components/TablePlugin.js.map +0 -1
  134. package/dist/components/ToolBarPlugin.d.ts +0 -10
  135. package/dist/components/ToolBarPlugin.d.ts.map +0 -1
  136. package/dist/components/ToolBarPlugin.js +0 -111
  137. package/dist/components/ToolBarPlugin.js.map +0 -1
  138. package/dist/components/context/AnnotationContext.d.ts +0 -8
  139. package/dist/components/context/AnnotationContext.d.ts.map +0 -1
  140. package/dist/components/context/AnnotationContext.js +0 -3
  141. package/dist/components/context/AnnotationContext.js.map +0 -1
  142. package/dist/components/exam/ExamineExam.d.ts +0 -5
  143. package/dist/components/exam/ExamineExam.d.ts.map +0 -1
  144. package/dist/components/exam/ExamineExam.js +0 -20
  145. package/dist/components/exam/ExamineExam.js.map +0 -1
  146. package/dist/components/exam/FinishExam.d.ts +0 -5
  147. package/dist/components/exam/FinishExam.d.ts.map +0 -1
  148. package/dist/components/exam/FinishExam.js +0 -17
  149. package/dist/components/exam/FinishExam.js.map +0 -1
  150. package/dist/components/grading/reactAnnotation.d.ts +0 -4
  151. package/dist/components/grading/reactAnnotation.d.ts.map +0 -1
  152. package/dist/components/grading/reactAnnotation.js +0 -54
  153. package/dist/components/grading/reactAnnotation.js.map +0 -1
  154. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts +0 -6
  155. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +0 -1
  156. package/dist/components/grading-instructions/EditableGradingInstruction.js +0 -113
  157. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +0 -1
  158. package/dist/components/grading-instructions/SlateTableEditor.d.ts +0 -22
  159. package/dist/components/grading-instructions/SlateTableEditor.d.ts.map +0 -1
  160. package/dist/components/grading-instructions/SlateTableEditor.js +0 -44
  161. package/dist/components/grading-instructions/SlateTableEditor.js.map +0 -1
  162. package/dist/components/grading-instructions/SlateUtils.d.ts +0 -5
  163. package/dist/components/grading-instructions/SlateUtils.d.ts.map +0 -1
  164. package/dist/components/grading-instructions/SlateUtils.js +0 -28
  165. package/dist/components/grading-instructions/SlateUtils.js.map +0 -1
  166. package/dist/components/grading-instructions/editor/FormatButton.d.ts +0 -9
  167. package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +0 -1
  168. package/dist/components/grading-instructions/editor/FormatButton.js +0 -26
  169. package/dist/components/grading-instructions/editor/FormatButton.js.map +0 -1
  170. package/dist/components/grading-instructions/editor/Formula.d.ts +0 -15
  171. package/dist/components/grading-instructions/editor/Formula.d.ts.map +0 -1
  172. package/dist/components/grading-instructions/editor/Formula.js +0 -41
  173. package/dist/components/grading-instructions/editor/Formula.js.map +0 -1
  174. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts +0 -7
  175. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts.map +0 -1
  176. package/dist/components/grading-instructions/editor/FormulaPopup.js +0 -49
  177. package/dist/components/grading-instructions/editor/FormulaPopup.js.map +0 -1
  178. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts +0 -6
  179. package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts.map +0 -1
  180. package/dist/components/grading-instructions/editor/ImageUploadButton.js +0 -77
  181. package/dist/components/grading-instructions/editor/ImageUploadButton.js.map +0 -1
  182. package/dist/components/grading-instructions/editor/List.d.ts +0 -9
  183. package/dist/components/grading-instructions/editor/List.d.ts.map +0 -1
  184. package/dist/components/grading-instructions/editor/List.js +0 -41
  185. package/dist/components/grading-instructions/editor/List.js.map +0 -1
  186. package/dist/components/grading-instructions/editor/MathPopup.d.ts +0 -10
  187. package/dist/components/grading-instructions/editor/MathPopup.d.ts.map +0 -1
  188. package/dist/components/grading-instructions/editor/MathPopup.js +0 -94
  189. package/dist/components/grading-instructions/editor/MathPopup.js.map +0 -1
  190. package/dist/components/grading-instructions/editor/Menu.d.ts +0 -1
  191. package/dist/components/grading-instructions/editor/Menu.d.ts.map +0 -1
  192. package/dist/components/grading-instructions/editor/Menu.js +0 -2
  193. package/dist/components/grading-instructions/editor/Menu.js.map +0 -1
  194. package/dist/components/grading-instructions/editor/NBSP.d.ts +0 -4
  195. package/dist/components/grading-instructions/editor/NBSP.d.ts.map +0 -1
  196. package/dist/components/grading-instructions/editor/NBSP.js +0 -17
  197. package/dist/components/grading-instructions/editor/NBSP.js.map +0 -1
  198. package/dist/components/grading-instructions/editor/Table.d.ts +0 -6
  199. package/dist/components/grading-instructions/editor/Table.d.ts.map +0 -1
  200. package/dist/components/grading-instructions/editor/Table.js +0 -186
  201. package/dist/components/grading-instructions/editor/Table.js.map +0 -1
  202. package/dist/components/grading-instructions/editor/findNode.d.ts +0 -3
  203. package/dist/components/grading-instructions/editor/findNode.d.ts.map +0 -1
  204. package/dist/components/grading-instructions/editor/findNode.js +0 -10
  205. package/dist/components/grading-instructions/editor/findNode.js.map +0 -1
  206. package/dist/components/grading-instructions/editor/keymap.d.ts +0 -2
  207. package/dist/components/grading-instructions/editor/keymap.d.ts.map +0 -1
  208. package/dist/components/grading-instructions/editor/keymap.js +0 -12
  209. package/dist/components/grading-instructions/editor/keymap.js.map +0 -1
  210. package/dist/components/grading-instructions/editor/localization.d.ts +0 -3
  211. package/dist/components/grading-instructions/editor/localization.d.ts.map +0 -1
  212. package/dist/components/grading-instructions/editor/localization.js +0 -36
  213. package/dist/components/grading-instructions/editor/localization.js.map +0 -1
  214. package/dist/components/grading-instructions/editor/math-svg.d.ts +0 -2
  215. package/dist/components/grading-instructions/editor/math-svg.d.ts.map +0 -1
  216. package/dist/components/grading-instructions/editor/math-svg.js +0 -22
  217. package/dist/components/grading-instructions/editor/math-svg.js.map +0 -1
  218. package/dist/components/grading-instructions/editor/math.d.ts +0 -4
  219. package/dist/components/grading-instructions/editor/math.d.ts.map +0 -1
  220. package/dist/components/grading-instructions/editor/math.js +0 -55
  221. package/dist/components/grading-instructions/editor/math.js.map +0 -1
  222. package/dist/components/grading-instructions/editor/noWrap.d.ts +0 -3
  223. package/dist/components/grading-instructions/editor/noWrap.d.ts.map +0 -1
  224. package/dist/components/grading-instructions/editor/noWrap.js +0 -13
  225. package/dist/components/grading-instructions/editor/noWrap.js.map +0 -1
  226. package/dist/components/grading-instructions/editor/schemas/formulaSchema.d.ts +0 -4
  227. package/dist/components/grading-instructions/editor/schemas/formulaSchema.d.ts.map +0 -1
  228. package/dist/components/grading-instructions/editor/schemas/formulaSchema.js +0 -55
  229. package/dist/components/grading-instructions/editor/schemas/formulaSchema.js.map +0 -1
  230. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts +0 -4
  231. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts.map +0 -1
  232. package/dist/components/grading-instructions/editor/schemas/image-schema.js +0 -47
  233. package/dist/components/grading-instructions/editor/schemas/image-schema.js.map +0 -1
  234. package/dist/components/grading-instructions/editor/schemas/imageSchema.d.ts +0 -4
  235. package/dist/components/grading-instructions/editor/schemas/imageSchema.d.ts.map +0 -1
  236. package/dist/components/grading-instructions/editor/schemas/imageSchema.js +0 -47
  237. package/dist/components/grading-instructions/editor/schemas/imageSchema.js.map +0 -1
  238. package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts +0 -72
  239. package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts.map +0 -1
  240. package/dist/components/grading-instructions/editor/schemas/listSchema.js +0 -7
  241. package/dist/components/grading-instructions/editor/schemas/listSchema.js.map +0 -1
  242. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.d.ts +0 -3
  243. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.d.ts.map +0 -1
  244. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js +0 -19
  245. package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js.map +0 -1
  246. package/dist/components/grading-instructions/editor/schemas/tableSchema.d.ts +0 -3
  247. package/dist/components/grading-instructions/editor/schemas/tableSchema.d.ts.map +0 -1
  248. package/dist/components/grading-instructions/editor/schemas/tableSchema.js +0 -43
  249. package/dist/components/grading-instructions/editor/schemas/tableSchema.js.map +0 -1
  250. package/dist/components/grading-instructions/editor/spanWithClass.d.ts +0 -3
  251. package/dist/components/grading-instructions/editor/spanWithClass.d.ts.map +0 -1
  252. package/dist/components/grading-instructions/editor/spanWithClass.js +0 -19
  253. package/dist/components/grading-instructions/editor/spanWithClass.js.map +0 -1
  254. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts +0 -3
  255. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts.map +0 -1
  256. package/dist/components/grading-instructions/editor/spanWithNowrap.js +0 -19
  257. package/dist/components/grading-instructions/editor/spanWithNowrap.js.map +0 -1
  258. package/dist/components/grading-instructions/prosemirror.d.ts +0 -8
  259. package/dist/components/grading-instructions/prosemirror.d.ts.map +0 -1
  260. package/dist/components/grading-instructions/prosemirror.js +0 -108
  261. package/dist/components/grading-instructions/prosemirror.js.map +0 -1
  262. package/dist/components/results/isExamFinishPageHook.d.ts +0 -2
  263. package/dist/components/results/isExamFinishPageHook.d.ts.map +0 -1
  264. package/dist/components/results/isExamFinishPageHook.js +0 -7
  265. package/dist/components/results/isExamFinishPageHook.js.map +0 -1
  266. package/dist/components/shared/CreateAnnotationPopup.d.ts +0 -6
  267. package/dist/components/shared/CreateAnnotationPopup.d.ts.map +0 -1
  268. package/dist/components/shared/CreateAnnotationPopup.js +0 -11
  269. package/dist/components/shared/CreateAnnotationPopup.js.map +0 -1
  270. package/dist/components/shared/PopupUtils.d.ts +0 -4
  271. package/dist/components/shared/PopupUtils.d.ts.map +0 -1
  272. package/dist/components/shared/PopupUtils.js +0 -26
  273. package/dist/components/shared/PopupUtils.js.map +0 -1
  274. package/dist/store/listenerMiddleware.d.ts +0 -89
  275. package/dist/store/listenerMiddleware.d.ts.map +0 -1
  276. package/dist/store/listenerMiddleware.js +0 -6
  277. package/dist/store/listenerMiddleware.js.map +0 -1
@@ -1,69 +0,0 @@
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 tags are rendered in and rendered 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
- });
68
- });
69
- //# sourceMappingURL=ImageUploadButton.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImageUploadButton.test.js","sourceRoot":"","sources":["../../../__tests__/editor/ImageUploadButton.test.tsx"],"names":[],"mappings":";;;;;AAAA,qCAAkC;AAClC,kDAAyE;AACzE,sDAAsD;AACtD,gGAIkD;AAClD,6EAAmD;AACnD,wCAA0C;AAC1C,uDAA6C;AAE7C,IAAI,CAAC,KAAK,CAAC,6BAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAEtE,MAAM,GAA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CAAC,EAAE,oBAAoB,aAAa,kBAAkB,EAAE,EAAE,CAAC,CAAA;gBAC/G,MAAM,CAAC,mBAAmB,CAAC,CAAC,uBAAuB,CACjD,CAAC,EACD,oBAAoB,qDAAkB,kBAAkB,EACxD,EAAE,CACH,CAAA;gBACD,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;gBACxC,MAAM,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,qDAAkB,IAAI,qDAAkB,EAAE,CAAC,CAAA;YACtF,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=List.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"List.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/List.test.tsx"],"names":[],"mappings":""}
@@ -1,72 +0,0 @@
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
@@ -1 +0,0 @@
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,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,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,SAAS,GAAG,iCAAiC,CAAA;QACnD,MAAM,WAAW,GAAG,wCAAwC,CAAA;QAC5D,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAC5D,MAAM,CAAC,KAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,SAAS,GAAG,iCAAiC,CAAA;QACn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AK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACvD,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,sBAAsB,CAAA;QACxC,MAAM,cAAc,GAAG,sDAAsD,CAAA;QAC7E,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,MAAM,oBAAS,CAAC,KAAK,CAAC,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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=nbsp.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nbsp.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/nbsp.test.tsx"],"names":[],"mappings":""}
@@ -1,55 +0,0 @@
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 - NBSP', () => {
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('NBSP is rendered as expected', () => {
25
- const inputData = '<p>&#160;bar</p>';
26
- const expectedOutput = '<p><span class="invisible invisible--nb-space ProseMirror-widget"></span>&nbsp;bar</p>';
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 content causes NBSP to be returned as expected', async () => {
32
- cleanup = (0, prosemirror_1.mockCreateRange)();
33
- const inputData = '<p>&#160;foo</p><p>bar</p>';
34
- const expectedOutput = '<p>&#160;foo</p><p>foo</p>';
35
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
36
- await act(async () => {
37
- (0, util_1.insertText)(await result.findByText('bar'), 'foo');
38
- });
39
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
40
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
41
- });
42
- it('Insert NBSP adds expected string', async () => {
43
- cleanup = (0, prosemirror_1.mockCreateRange)();
44
- const inputData = '<p>&#160;foo</p><p>bar</p>';
45
- const expectedOutput = '<p>&#160;&#160;foo</p><p>bar</p>';
46
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
47
- expect(onContentChangeMock).toHaveBeenCalledTimes(0);
48
- await act(async () => {
49
- await user_event_1.default.click(await result.findByText('NBSP'));
50
- });
51
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
52
- expect(onContentChangeMock).toHaveBeenLastCalledWith(expectedOutput, '');
53
- });
54
- });
55
- //# sourceMappingURL=nbsp.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nbsp.test.js","sourceRoot":"","sources":["../../../__tests__/editor/nbsp.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,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,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,SAAS,GAAG,kBAAkB,CAAA;QACpC,MAAM,cAAc,GAAG,wFAAwF,CAAA;QAC/G,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,0DAA0D,EAAE,KAAK,IAAI,EAAE;QACxE,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,4BAA4B,CAAA;QAC9C,MAAM,cAAc,GAAG,4BAA4B,CAAA;QACnD,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,IAAA,iBAAU,EAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,4BAA4B,CAAA;QAC9C,MAAM,cAAc,GAAG,kCAAkC,CAAA;QACzD,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,MAAM,oBAAS,CAAC,KAAK,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;QACxD,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"}
@@ -1,2 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- //# sourceMappingURL=Table.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/Table.test.tsx"],"names":[],"mappings":"AAIA,OAAO,2BAA2B,CAAA"}
@@ -1,172 +0,0 @@
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
@@ -1 +0,0 @@
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,GA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E,CAAC;YAClB,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YAC3C,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE;YACxB,wBAAwB;SACzB,CAAA;IACH,CAAC,CAAA;IACD,OAAO,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,GAAG,mBAAmB,CAAC,CAAA;AACzE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=br.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"br.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/br.test.tsx"],"names":[],"mappings":""}
@@ -1,39 +0,0 @@
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 - BR', () => {
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('BR is rendered as expected', () => {
21
- const inputData = '<p>bar<br/></p>';
22
- const expectedOutput = '<p>bar<br><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 BR to be returned as expected', async () => {
28
- cleanup = (0, prosemirror_1.mockCreateRange)();
29
- const inputData = '<p>foo<br/></p><p>bar</p>';
30
- const expectedOutput = '<p>foo<br/></p><p>foo</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
- });
39
- //# sourceMappingURL=br.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"br.test.js","sourceRoot":"","sources":["../../../__tests__/editor/br.test.tsx"],"names":[],"mappings":";;AAAA,kDAAuD;AACvD,sDAAsD;AACtD,gGAAoF;AACpF,wCAA0C;AAE1C,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,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,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,SAAS,GAAG,iBAAiB,CAAA;QACnC,MAAM,cAAc,GAAG,sDAAsD,CAAA;QAC7E,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,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,2BAA2B,CAAA;QAC7C,MAAM,cAAc,GAAG,2BAA2B,CAAA;QAClD,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,IAAA,iBAAU,EAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=hr.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hr.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/hr.test.tsx"],"names":[],"mappings":""}
@@ -1,39 +0,0 @@
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 - HR', () => {
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('HR is rendered as expected', () => {
21
- const inputData = '<p>bar</p><hr/>';
22
- const expectedOutput = '<p>bar</p><hr>';
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 HR to be returned as expected', async () => {
28
- cleanup = (0, prosemirror_1.mockCreateRange)();
29
- const inputData = '<p>foo</p><hr/><p>bar</p>';
30
- const expectedOutput = '<p>foo</p><hr/><p>foo</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
- });
39
- //# sourceMappingURL=hr.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hr.test.js","sourceRoot":"","sources":["../../../__tests__/editor/hr.test.tsx"],"names":[],"mappings":";;AAAA,kDAAuD;AACvD,sDAAsD;AACtD,gGAAoF;AACpF,wCAA0C;AAE1C,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,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,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,SAAS,GAAG,iBAAiB,CAAA;QACnC,MAAM,cAAc,GAAG,gBAAgB,CAAA;QACvC,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,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,2BAA2B,CAAA;QAC7C,MAAM,cAAc,GAAG,2BAA2B,CAAA;QAClD,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,IAAA,iBAAU,EAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=no-wrap.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-wrap.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/no-wrap.test.tsx"],"names":[],"mappings":""}
@@ -1,43 +0,0 @@
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 act = react_1.act;
7
- describe('Editor - e-no-wrap', () => {
8
- let cleanup;
9
- let onContentChangeMock;
10
- beforeEach(() => {
11
- onContentChangeMock = jest.fn();
12
- });
13
- afterEach(() => {
14
- if (cleanup) {
15
- cleanup();
16
- }
17
- cleanup = null;
18
- });
19
- it('HR is rendered as expected', () => {
20
- const inputData = '<p>bar</p><hr/>';
21
- const expectedOutput = '<p>bar</p><hr>';
22
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
23
- const table = result.container.querySelector('.ProseMirror');
24
- expect(table.innerHTML).toBe(expectedOutput);
25
- });
26
- it('Change in content causes HR to be returned as expected', async () => {
27
- cleanup = (0, prosemirror_1.mockCreateRange)();
28
- const inputData = '<p>foo</p><hr/><p>bar</p>';
29
- const expectedOutput = '<p>foo</p><hr/><p>foo</p>';
30
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
31
- await act(async () => {
32
- insertText(await result.findByText('bar'), 'foo');
33
- });
34
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
35
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
36
- });
37
- });
38
- function insertText(element, text) {
39
- react_1.fireEvent.input(element, {
40
- target: { innerText: text, innerHTML: text }
41
- });
42
- }
43
- //# sourceMappingURL=no-wrap.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-wrap.test.js","sourceRoot":"","sources":["../../../__tests__/editor/no-wrap.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,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,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,SAAS,GAAG,iBAAiB,CAAA;QACnC,MAAM,cAAc,GAAG,gBAAgB,CAAA;QACvC,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,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;QAC3B,MAAM,SAAS,GAAG,2BAA2B,CAAA;QAC7C,MAAM,cAAc,GAAG,2BAA2B,CAAA;QAClD,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,UAAU,CAAC,OAAoB,EAAE,IAAY;IACpD,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=noWrap.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noWrap.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/noWrap.test.tsx"],"names":[],"mappings":""}