@digabi/exam-engine-core 22.1.3-alpha.2 → 22.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  2. package/dist/components/context/GradingInstructionContext.d.ts +6 -11
  3. package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
  4. package/dist/components/context/GradingInstructionContext.js.map +1 -1
  5. package/dist/components/exam/DNDAnswer.d.ts +4 -0
  6. package/dist/components/exam/DNDAnswer.d.ts.map +1 -0
  7. package/dist/components/exam/DNDAnswer.js +36 -0
  8. package/dist/components/exam/DNDAnswer.js.map +1 -0
  9. package/dist/components/exam/DragAndDrop.d.ts +3 -0
  10. package/dist/components/exam/DragAndDrop.d.ts.map +1 -0
  11. package/dist/components/exam/DragAndDrop.js +7 -0
  12. package/dist/components/exam/DragAndDrop.js.map +1 -0
  13. package/dist/components/exam/NativeDND.d.ts +3 -0
  14. package/dist/components/exam/NativeDND.d.ts.map +1 -0
  15. package/dist/components/exam/NativeDND.js +75 -0
  16. package/dist/components/exam/NativeDND.js.map +1 -0
  17. package/dist/components/grading/AnnotatableGradingAnswer.d.ts +4 -0
  18. package/dist/components/grading/AnnotatableGradingAnswer.d.ts.map +1 -0
  19. package/dist/components/grading/AnnotatableGradingAnswer.js +24 -0
  20. package/dist/components/grading/AnnotatableGradingAnswer.js.map +1 -0
  21. package/dist/components/grading/GradingAnswer.d.ts.map +1 -1
  22. package/dist/components/grading/GradingAnswer.js +38 -16
  23. package/dist/components/grading/GradingAnswer.js.map +1 -1
  24. package/dist/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
  25. package/dist/components/grading-instructions/AnswerGradingInstruction.js +4 -3
  26. package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
  27. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +1 -1
  28. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -1
  29. package/dist/components/grading-instructions/GradingInstructionProvider.js +1 -4
  30. package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
  31. package/dist/components/grading-instructions/GradingInstructions.d.ts +6 -2
  32. package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
  33. package/dist/components/grading-instructions/GradingInstructions.js +2 -3
  34. package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
  35. package/dist/components/shared/AnnotationWrapper.d.ts +5 -0
  36. package/dist/components/shared/AnnotationWrapper.d.ts.map +1 -0
  37. package/dist/components/shared/AnnotationWrapper.js +24 -0
  38. package/dist/components/shared/AnnotationWrapper.js.map +1 -0
  39. package/dist/components/shared/Mark.d.ts +9 -0
  40. package/dist/components/shared/Mark.d.ts.map +1 -0
  41. package/dist/components/shared/Mark.js +14 -0
  42. package/dist/components/shared/Mark.js.map +1 -0
  43. package/dist/components/shared/Popup.js +2 -2
  44. package/dist/components/shared/Popup.js.map +1 -1
  45. package/dist/dom-utils.d.ts.map +1 -1
  46. package/dist/dom-utils.js +4 -2
  47. package/dist/dom-utils.js.map +1 -1
  48. package/dist/i18n/fi-FI.d.ts +1 -0
  49. package/dist/i18n/fi-FI.d.ts.map +1 -1
  50. package/dist/i18n/fi-FI.js +2 -1
  51. package/dist/i18n/fi-FI.js.map +1 -1
  52. package/dist/i18n/sv-FI.d.ts.map +1 -1
  53. package/dist/i18n/sv-FI.js +2 -1
  54. package/dist/i18n/sv-FI.js.map +1 -1
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +1 -0
  58. package/dist/index.js.map +1 -1
  59. package/dist/main-bundle.js +1 -1
  60. package/dist/main.css +1 -1
  61. package/package.json +4 -12
  62. package/dist/__tests__/EditableGradingInstruction.test.d.ts +0 -2
  63. package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +0 -1
  64. package/dist/__tests__/EditableGradingInstruction.test.js +0 -171
  65. package/dist/__tests__/EditableGradingInstruction.test.js.map +0 -1
  66. package/dist/__tests__/FormatButton.test.d.ts +0 -2
  67. package/dist/__tests__/FormatButton.test.d.ts.map +0 -1
  68. package/dist/__tests__/FormatButton.test.js +0 -94
  69. package/dist/__tests__/FormatButton.test.js.map +0 -1
  70. package/dist/__tests__/editor/Formula.test.d.ts +0 -2
  71. package/dist/__tests__/editor/Formula.test.d.ts.map +0 -1
  72. package/dist/__tests__/editor/Formula.test.js +0 -43
  73. package/dist/__tests__/editor/Formula.test.js.map +0 -1
  74. package/dist/__tests__/editor/br.test.d.ts +0 -2
  75. package/dist/__tests__/editor/br.test.d.ts.map +0 -1
  76. package/dist/__tests__/editor/br.test.js +0 -43
  77. package/dist/__tests__/editor/br.test.js.map +0 -1
  78. package/dist/__tests__/editor/hr.test.d.ts +0 -2
  79. package/dist/__tests__/editor/hr.test.d.ts.map +0 -1
  80. package/dist/__tests__/editor/hr.test.js +0 -43
  81. package/dist/__tests__/editor/hr.test.js.map +0 -1
  82. package/dist/__tests__/editor/nbsp.test.d.ts +0 -2
  83. package/dist/__tests__/editor/nbsp.test.d.ts.map +0 -1
  84. package/dist/__tests__/editor/nbsp.test.js +0 -59
  85. package/dist/__tests__/editor/nbsp.test.js.map +0 -1
  86. package/dist/__tests__/editor/noWrap.test.d.ts +0 -2
  87. package/dist/__tests__/editor/noWrap.test.d.ts.map +0 -1
  88. package/dist/__tests__/editor/noWrap.test.js +0 -62
  89. package/dist/__tests__/editor/noWrap.test.js.map +0 -1
  90. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts +0 -8
  91. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts.map +0 -1
  92. package/dist/__tests__/utils/ProseMirrorWrapper.js +0 -44
  93. package/dist/__tests__/utils/ProseMirrorWrapper.js.map +0 -1
  94. package/dist/__tests__/utils/prosemirror.d.ts +0 -3
  95. package/dist/__tests__/utils/prosemirror.d.ts.map +0 -1
  96. package/dist/__tests__/utils/prosemirror.js +0 -38
  97. package/dist/__tests__/utils/prosemirror.js.map +0 -1
  98. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts +0 -2
  99. package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts.map +0 -1
  100. package/dist/__tests__/utils/renderEditableGradingInstruction.js +0 -16
  101. package/dist/__tests__/utils/renderEditableGradingInstruction.js.map +0 -1
  102. package/dist/components/Localization.d.ts +0 -5
  103. package/dist/components/Localization.d.ts.map +0 -1
  104. package/dist/components/Localization.js +0 -9
  105. package/dist/components/Localization.js.map +0 -1
  106. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts +0 -6
  107. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +0 -1
  108. package/dist/components/grading-instructions/EditableGradingInstruction.js +0 -87
  109. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +0 -1
  110. package/dist/components/grading-instructions/GradingInstruction.d.ts +0 -7
  111. package/dist/components/grading-instructions/GradingInstruction.d.ts.map +0 -1
  112. package/dist/components/grading-instructions/GradingInstruction.js +0 -9
  113. package/dist/components/grading-instructions/GradingInstruction.js.map +0 -1
  114. package/dist/components/grading-instructions/editor/CurrentElement.d.ts +0 -2
  115. package/dist/components/grading-instructions/editor/CurrentElement.d.ts.map +0 -1
  116. package/dist/components/grading-instructions/editor/CurrentElement.js +0 -8
  117. package/dist/components/grading-instructions/editor/CurrentElement.js.map +0 -1
  118. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts +0 -5
  119. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts.map +0 -1
  120. package/dist/components/grading-instructions/editor/CurrentLocalization.js +0 -17
  121. package/dist/components/grading-instructions/editor/CurrentLocalization.js.map +0 -1
  122. package/dist/components/grading-instructions/editor/FormatButton.d.ts +0 -8
  123. package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +0 -1
  124. package/dist/components/grading-instructions/editor/FormatButton.js +0 -23
  125. package/dist/components/grading-instructions/editor/FormatButton.js.map +0 -1
  126. package/dist/components/grading-instructions/editor/Formula.d.ts +0 -17
  127. package/dist/components/grading-instructions/editor/Formula.d.ts.map +0 -1
  128. package/dist/components/grading-instructions/editor/Formula.js +0 -81
  129. package/dist/components/grading-instructions/editor/Formula.js.map +0 -1
  130. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts +0 -7
  131. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts.map +0 -1
  132. package/dist/components/grading-instructions/editor/FormulaPopup.js +0 -49
  133. package/dist/components/grading-instructions/editor/FormulaPopup.js.map +0 -1
  134. package/dist/components/grading-instructions/editor/Localization.d.ts +0 -3
  135. package/dist/components/grading-instructions/editor/Localization.d.ts.map +0 -1
  136. package/dist/components/grading-instructions/editor/Localization.js +0 -36
  137. package/dist/components/grading-instructions/editor/Localization.js.map +0 -1
  138. package/dist/components/grading-instructions/editor/NBSP.d.ts +0 -4
  139. package/dist/components/grading-instructions/editor/NBSP.d.ts.map +0 -1
  140. package/dist/components/grading-instructions/editor/NBSP.js +0 -17
  141. package/dist/components/grading-instructions/editor/NBSP.js.map +0 -1
  142. package/dist/components/grading-instructions/editor/Table.d.ts +0 -5
  143. package/dist/components/grading-instructions/editor/Table.d.ts.map +0 -1
  144. package/dist/components/grading-instructions/editor/Table.js +0 -181
  145. package/dist/components/grading-instructions/editor/Table.js.map +0 -1
  146. package/dist/components/grading-instructions/editor/localizatio.d.ts +0 -3
  147. package/dist/components/grading-instructions/editor/localizatio.d.ts.map +0 -1
  148. package/dist/components/grading-instructions/editor/localizatio.js +0 -36
  149. package/dist/components/grading-instructions/editor/localizatio.js.map +0 -1
  150. package/dist/components/grading-instructions/editor/localizationSpan.d.ts +0 -3
  151. package/dist/components/grading-instructions/editor/localizationSpan.d.ts.map +0 -1
  152. package/dist/components/grading-instructions/editor/localizationSpan.js +0 -36
  153. package/dist/components/grading-instructions/editor/localizationSpan.js.map +0 -1
  154. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts +0 -3
  155. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts.map +0 -1
  156. package/dist/components/grading-instructions/editor/spanWithNowrap.js +0 -19
  157. package/dist/components/grading-instructions/editor/spanWithNowrap.js.map +0 -1
  158. package/dist/components/grading-instructions/editor/spanWithPath.d.ts +0 -3
  159. package/dist/components/grading-instructions/editor/spanWithPath.d.ts.map +0 -1
  160. package/dist/components/grading-instructions/editor/spanWithPath.js +0 -24
  161. package/dist/components/grading-instructions/editor/spanWithPath.js.map +0 -1
@@ -1,171 +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 act = react_1.act;
10
- describe('EditableGradingInstruction', () => {
11
- let cleanup;
12
- let onContentChangeMock;
13
- beforeEach(() => {
14
- onContentChangeMock = jest.fn();
15
- });
16
- afterEach(() => {
17
- if (cleanup) {
18
- cleanup();
19
- }
20
- cleanup = null;
21
- });
22
- describe('table', () => {
23
- it('Table is rendered as expected', () => {
24
- const inputData = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
25
- const expectedOutput = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
26
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
27
- const table = result.container.querySelector('.ProseMirror');
28
- expect(table.innerHTML).toBe(expectedOutput);
29
- });
30
- it('Change in table is returned as expected', async () => {
31
- cleanup = mockCreateRange();
32
- const inputData = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
33
- const expectedOutput = '<table class="e-table"><tbody><tr><td>bar</td></tr></tbody></table>';
34
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
35
- await act(async () => {
36
- insertText(await result.findByText('foo'), 'bar');
37
- });
38
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
39
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
40
- });
41
- it('Insert table adds expected table', async () => {
42
- const inputData = '';
43
- const expectedOutput = '<table class="e-table e-width-half"><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table>';
44
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
45
- await act(async () => {
46
- await user_event_1.default.click(await result.findByText('Lisää taulukko'));
47
- });
48
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
49
- });
50
- it('Remove table removes table', async () => {
51
- const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
52
- const expectedOutput = '<p></p>';
53
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
54
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista taulukko');
55
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
56
- });
57
- it('Insert column adds column', async () => {
58
- const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
59
- const expectedOutput = '<table><tbody><tr><td>foo</td><td></td></tr></tbody></table>';
60
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
61
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää sarake');
62
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
63
- });
64
- it('Remove column removes column', async () => {
65
- const inputData = '<table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></table>';
66
- const expectedOutput = '<table><tbody><tr><td>bar</td></tr></tbody></table>';
67
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
68
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista sarake');
69
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
70
- });
71
- it('Insert row adds row', async () => {
72
- const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
73
- const expectedOutput = '<table><tbody><tr><td>foo</td></tr><tr><td></td></tr></tbody></table>';
74
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
75
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää rivi');
76
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
77
- });
78
- it('Remove row removes row', async () => {
79
- const inputData = '<table><tbody><tr><td>foo</td></tr><tr><td>bar</td></tr></tbody></table>';
80
- const expectedOutput = '<table><tbody><tr><td>bar</td></tr></tbody></table>';
81
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
82
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista rivi');
83
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
84
- });
85
- it('Full width changes full width class to table', async () => {
86
- const inputData = '<table class="e-width-half"><tbody><tr><td>foo</td></tr></tbody></table>';
87
- const expectedOutput = '<table class="e-width-full"><tbody><tr><td>foo</td></tr></tbody></table>';
88
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
89
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Täysi leveys');
90
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
91
- });
92
- it('Half width changes half width class to table', async () => {
93
- const inputData = '<table class="e-width-full"><tbody><tr><td>foo</td></tr></tbody></table>';
94
- const expectedOutput = '<table class="e-width-half"><tbody><tr><td>foo</td></tr></tbody></table>';
95
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
96
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Puolikas leveys');
97
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
98
- });
99
- it('Remove borders adds e-table--borderless class to table', async () => {
100
- const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
101
- const expectedOutput = '<table class="e-table--borderless"><tbody><tr><td>foo</td></tr></tbody></table>';
102
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
103
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista reunat');
104
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
105
- });
106
- it('Add borders removes e-table--borderless class from table', async () => {
107
- const inputData = '<table class="e-table--borderless"><tbody><tr><td>foo</td></tr></tbody></table>';
108
- const expectedOutput = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
109
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
110
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää reunat');
111
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
112
- });
113
- it('Remove zebra removes class from table', async () => {
114
- const inputData = '<table class="e-table--zebra"><tbody><tr><td>foo</td></tr></tbody></table>';
115
- const expectedOutput = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
116
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
117
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista kuviointi');
118
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
119
- });
120
- it('Add zebra adds e-table--zebra class to table', async () => {
121
- const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
122
- const expectedOutput = '<table class="e-table--zebra"><tbody><tr><td>foo</td></tr></tbody></table>';
123
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
124
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää kuviointi');
125
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
126
- });
127
- });
128
- });
129
- async function clickTableMenuButtonWithFocusOnCell(result, cellText, buttonText) {
130
- await act(async () => {
131
- await focusOnTablesCell(result, cellText);
132
- await user_event_1.default.click(await result.findByText(buttonText));
133
- });
134
- }
135
- async function focusOnTablesCell(result, text) {
136
- // Replace cell's text with same text
137
- // Hack to get focus on cell without need to mock createRange
138
- insertText(await result.findByText(text), text);
139
- }
140
- function insertText(element, text) {
141
- react_1.fireEvent.input(element, {
142
- target: { innerText: text, innerHTML: text }
143
- });
144
- }
145
- function mockCreateRange() {
146
- const originalCreateRange = global.window.document.createRange;
147
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
148
- // @ts-expect-error
149
- global.Range = function Range() { };
150
- const createContextualFragment = (html) => {
151
- const div = document.createElement('div');
152
- div.innerHTML = html;
153
- return div.children[0];
154
- };
155
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
156
- // @ts-expect-error
157
- Range.prototype.createContextualFragment = (html) => createContextualFragment(html);
158
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
159
- // @ts-expect-error
160
- global.window.document.createRange = function createRange() {
161
- return {
162
- setEnd: () => { },
163
- setStart: () => { },
164
- getBoundingClientRect: () => ({ right: 0 }),
165
- getClientRects: () => [],
166
- createContextualFragment
167
- };
168
- };
169
- return () => (global.window.document.createRange = originalCreateRange);
170
- }
171
- //# sourceMappingURL=EditableGradingInstruction.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditableGradingInstruction.test.js","sourceRoot":"","sources":["../../__tests__/EditableGradingInstruction.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAgF;AAChF,6EAAmD;AACnD,+FAAmF;AAEnF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,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,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;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ing-library/jest-dom';
2
- //# sourceMappingURL=FormatButton.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormatButton.test.d.ts","sourceRoot":"","sources":["../../__tests__/FormatButton.test.tsx"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA"}
@@ -1,94 +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 = __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 act = react_2.act;
14
- describe('FormatButton', () => {
15
- beforeAll(() => {
16
- (0, prosemirror_1.mockCreateRange)();
17
- });
18
- afterEach(() => {
19
- (0, react_2.cleanup)();
20
- });
21
- describe('Italics', () => {
22
- it('Renders italics button', () => {
23
- const props = { markName: 'em', displayName: 'Italic' };
24
- const { button } = renderEditorWithFormatButton(props);
25
- expect(button).toHaveTextContent(props.displayName);
26
- });
27
- it('Toggles button active state when clicked', async () => {
28
- const props = { markName: 'em', displayName: 'Italic' };
29
- const { button } = renderEditorWithFormatButton(props);
30
- expect(button).toHaveStyle('font-weight: normal');
31
- await user_event_1.default.click(button);
32
- expect(button).toHaveStyle('font-weight: bold');
33
- await user_event_1.default.click(button);
34
- expect(button).toHaveStyle('font-weight: normal');
35
- });
36
- it('formats text', async () => {
37
- const props = { markName: 'em', displayName: 'Italic' };
38
- const { button, paragraph } = renderEditorWithFormatButton(props);
39
- await user_event_1.default.click(button);
40
- await act(async () => await (0, prosemirror_1.promisifiedFireEventInput)(paragraph, { target: { innerHTML: 'hello' } }));
41
- expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('hello');
42
- });
43
- it('em tags are rendered as italic', () => {
44
- const props = { markName: 'em', displayName: 'Italic', innerHtml: '<em>Italic text</em>' };
45
- const { paragraph } = renderEditorWithFormatButton(props);
46
- expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('Italic text');
47
- });
48
- it('i tags are rendered as italic', () => {
49
- const props = { markName: 'em', displayName: 'Italic', innerHtml: '<i>Italic text</i>' };
50
- const { paragraph } = renderEditorWithFormatButton(props);
51
- expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('Italic text');
52
- });
53
- });
54
- describe('Bold', () => {
55
- it('Renders bold button', () => {
56
- const props = { markName: 'strong', displayName: 'Bold' };
57
- const { button } = renderEditorWithFormatButton(props);
58
- expect(button).toHaveTextContent(props.displayName);
59
- });
60
- it('Toggles button active state when clicked', async () => {
61
- const props = { markName: 'strong', displayName: 'Bold' };
62
- const { button } = renderEditorWithFormatButton(props);
63
- expect(button).toHaveStyle('font-weight: normal');
64
- await user_event_1.default.click(button);
65
- expect(button).toHaveStyle('font-weight: bold');
66
- await user_event_1.default.click(button);
67
- expect(button).toHaveStyle('font-weight: normal');
68
- });
69
- it('formats text', async () => {
70
- const props = { markName: 'strong', displayName: 'Bold' };
71
- const { button, paragraph } = renderEditorWithFormatButton(props);
72
- await user_event_1.default.click(button);
73
- await act(async () => await (0, prosemirror_1.promisifiedFireEventInput)(paragraph, { target: { innerHTML: 'hello' } }));
74
- expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('hello');
75
- });
76
- it('b tags are rendered as bold', () => {
77
- const props = { markName: 'strong', displayName: 'bold', innerHtml: '<b>Bold text</b>' };
78
- const { paragraph } = renderEditorWithFormatButton(props);
79
- expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('Bold text');
80
- });
81
- it('strong tags are rendered as bold', () => {
82
- const props = { markName: 'strong', displayName: 'bold', innerHtml: '<strong>Bold text</strong>' };
83
- const { paragraph } = renderEditorWithFormatButton(props);
84
- expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('Bold text');
85
- });
86
- });
87
- function renderEditorWithFormatButton(props) {
88
- const { markName, displayName, innerHtml = '' } = props;
89
- const { getByRole } = (0, react_2.render)(react_1.default.createElement(ProseMirrorWrapper_1.default, { innerHtml: innerHtml },
90
- react_1.default.createElement(FormatButton_1.default, { markName: markName, displayName: displayName })));
91
- return { button: getByRole('button'), paragraph: getByRole('paragraph') };
92
- }
93
- });
94
- //# sourceMappingURL=FormatButton.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormatButton.test.js","sourceRoot":"","sources":["../../__tests__/FormatButton.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,qCAAkC;AAClC,kDAAgF;AAChF,oFAA2D;AAC3D,qDAAgF;AAChF,8GAAqF;AACrF,6EAAmD;AAEnD,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,WAAW,EAAE,QAAQ,EAAE,CAAA;YACvD,MAAM,EAAE,MAAM,EAAE,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAA;YACtD,MAAM,CAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACrD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;YACxD,MAAM,KAAK,GAAG,EA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AE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC1C,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAAA;YAClG,MAAM,EAAE,SAAS,EAAE,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAA;YACzD,MAAM,CAAC,IAAA,cAAM,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAA;QAC9E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,SAAS,4BAA4B,CAAC,KAAoE;QACxG,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,KAAK,CAAA;QACvD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,cAAM,EAC1B,8BAAC,4BAAkB,IAAC,SAAS,EAAE,SAAS;YACtC,8BAAC,sBAAY,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAI,CAC3C,CACtB,CAAA;QACD,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,CAAA;IAC3E,CAAC;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Formula.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Formula.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/Formula.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 - Formula', () => {
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('Formula is rendered as expected', () => {
20
- const inputData = '<p>bar <e:formula data-editor-id="e-formula">foo</e:formula></p>';
21
- const expectedOutput = '<p>bar <img alt="foo" src="/math.svg?latex=foo"><img class="ProseMirror-separator" alt=""><br class="ProseMirror-trailingBreak"></p>';
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 formula to be returned as expected', async () => {
27
- cleanup = (0, prosemirror_1.mockCreateRange)();
28
- 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">bar</e:formula></p>';
29
- const expectedOutput = '<p>foo</p><p><e:formula mode="inline">foo</e:formula><e:formula>bar</e:formula></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=Formula.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Formula.test.js","sourceRoot":"","sources":["../../../__tests__/editor/Formula.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,U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AAC,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=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,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 - BR', () => {
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('BR is rendered as expected', () => {
20
- const inputData = '<p>bar<br/></p>';
21
- const expectedOutput = '<p>bar<br><br class="ProseMirror-trailingBreak"></p>';
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 BR to be returned as expected', async () => {
27
- cleanup = (0, prosemirror_1.mockCreateRange)();
28
- const inputData = '<p>foo<br/></p><p>bar</p>';
29
- const expectedOutput = '<p>foo<br/></p><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=br.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"br.test.js","sourceRoot":"","sources":["../../../__tests__/editor/br.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,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,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=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,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 - HR', () => {
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=hr.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hr.test.js","sourceRoot":"","sources":["../../../__tests__/editor/hr.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,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,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=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,59 +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 act = react_1.act;
11
- describe('Editor - NBSP', () => {
12
- let cleanup;
13
- let onContentChangeMock;
14
- beforeEach(() => {
15
- onContentChangeMock = jest.fn();
16
- });
17
- afterEach(() => {
18
- if (cleanup) {
19
- cleanup();
20
- }
21
- cleanup = null;
22
- });
23
- it('NBSP is rendered as expected', () => {
24
- const inputData = '<p>&#160;bar</p>';
25
- const expectedOutput = '<p><span class="invisible invisible--nb-space ProseMirror-widget"></span>&nbsp;bar</p>';
26
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
27
- const table = result.container.querySelector('.ProseMirror');
28
- expect(table.innerHTML).toBe(expectedOutput);
29
- });
30
- it('Change in content causes NBSP to be returned as expected', async () => {
31
- cleanup = (0, prosemirror_1.mockCreateRange)();
32
- const inputData = '<p>&#160;foo</p><p>bar</p>';
33
- const expectedOutput = '<p>&#160;foo</p><p>foo</p>';
34
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
35
- await act(async () => {
36
- insertText(await result.findByText('bar'), 'foo');
37
- });
38
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
39
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
40
- });
41
- it('Insert NBSP adds expected string', async () => {
42
- cleanup = (0, prosemirror_1.mockCreateRange)();
43
- const inputData = '<p>&#160;foo</p><p>bar</p>';
44
- const expectedOutput = '<p>&#160;&#160;foo</p><p>bar</p>';
45
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
46
- expect(onContentChangeMock).toHaveBeenCalledTimes(0);
47
- await act(async () => {
48
- await user_event_1.default.click(await result.findByText('NBSP'));
49
- });
50
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
51
- expect(onContentChangeMock).toHaveBeenLastCalledWith(expectedOutput, '');
52
- });
53
- });
54
- function insertText(element, text) {
55
- react_1.fireEvent.input(element, {
56
- target: { innerText: text, innerHTML: text }
57
- });
58
- }
59
- //# 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,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AACpF,6EAAmD;AAEnD,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,4B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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":""}
@@ -1,62 +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-nowrap', () => {
8
- let cleanup;
9
- let onContentChangeMock;
10
- beforeEach(() => {
11
- onContentChangeMock = jest.fn();
12
- cleanup = (0, prosemirror_1.mockCreateRange)();
13
- });
14
- afterEach(() => {
15
- if (cleanup) {
16
- cleanup();
17
- }
18
- cleanup = null;
19
- });
20
- it('e-nowrap is rendered and returned as expected outside paragraph', async () => {
21
- const inputData = '<p>bar</p><span class="e-nowrap">foo</span>';
22
- const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
23
- const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
24
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
25
- await act(async () => {
26
- insertText(await result.findByText('bar'), 'foo');
27
- });
28
- const element = result.container.querySelector('.ProseMirror');
29
- expect(element.innerHTML).toBe(expectedDom);
30
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
31
- });
32
- it('e:formula is rendered as expected when wrapped inside e-nowrap', async () => {
33
- const inputData = '<p>bar</p><span class="e-nowrap"><e:formula data-editor-id=e-formula>foo</e:formula></span>';
34
- const expectedDom = '<p>foo</p><p><span class="e-nowrap"><img alt="foo" src="/math.svg?latex=foo"><img class="ProseMirror-separator" alt=""></span><br class="ProseMirror-trailingBreak"></p>';
35
- const expectedOutput = '<p>foo</p><p><span class="e-nowrap"><e:formula>foo</e:formula></span></p>';
36
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
37
- await act(async () => {
38
- insertText(await result.findByText('bar'), 'foo');
39
- });
40
- const element = result.container.querySelector('.ProseMirror');
41
- expect(element.innerHTML).toBe(expectedDom);
42
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
43
- });
44
- it('e-nowrap is rendered as expected inside paragraph', async () => {
45
- const inputData = '<p>bar</p><p><span class="e-nowrap">foo</span></p>';
46
- const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
47
- const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
48
- const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
49
- await act(async () => {
50
- insertText(await result.findByText('bar'), 'foo');
51
- });
52
- const element = result.container.querySelector('.ProseMirror');
53
- expect(element.innerHTML).toBe(expectedDom);
54
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
55
- });
56
- });
57
- function insertText(element, text) {
58
- react_1.fireEvent.input(element, {
59
- target: { innerText: text, innerHTML: text }
60
- });
61
- }
62
- //# sourceMappingURL=noWrap.test.js.map