@digabi/exam-engine-core 22.0.4-editor-ee-to-em.1 → 22.0.4-editor-ee-to-em.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/editor/Table.test.js +4 -4
- package/dist/__tests__/editor/Table.test.js.map +1 -1
- package/dist/__tests__/editor/undoRedo.test.d.ts +2 -0
- package/dist/__tests__/editor/undoRedo.test.d.ts.map +1 -0
- package/dist/__tests__/editor/undoRedo.test.js +61 -0
- package/dist/__tests__/editor/undoRedo.test.js.map +1 -0
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/grading-instructions/editor/List.d.ts +1 -1
- package/dist/components/grading-instructions/editor/List.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/NBSP.d.ts +1 -1
- package/dist/components/grading-instructions/editor/NBSP.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/Table.d.ts +1 -1
- package/dist/components/grading-instructions/editor/Table.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/UndoRedoButtons.d.ts +6 -0
- package/dist/components/grading-instructions/editor/UndoRedoButtons.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/UndoRedoButtons.js +19 -0
- package/dist/components/grading-instructions/editor/UndoRedoButtons.js.map +1 -0
- package/dist/components/grading-instructions/editor/findNode.d.ts +1 -1
- package/dist/components/grading-instructions/editor/findNode.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts +69 -3
- package/dist/components/grading-instructions/editor/schemas/listSchema.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/schemas/tableSchema.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/schemas/tableSchema.js +13 -3
- package/dist/components/grading-instructions/editor/schemas/tableSchema.js.map +1 -1
- package/dist/components/shared/Popup.js +2 -2
- package/dist/components/shared/Popup.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/package.json +2 -2
@@ -22,16 +22,16 @@ describe('Table', () => {
|
|
22
22
|
cleanup = null;
|
23
23
|
});
|
24
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>';
|
25
|
+
const inputData = '<table class="e-table"><tbody><tr class="e-text-top"><td scope="row">foo</td></tr></tbody></table>';
|
26
|
+
const expectedOutput = '<table class="e-table"><tbody><tr class="e-text-top"><td scope="row">foo</td></tr></tbody></table>';
|
27
27
|
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
|
28
28
|
const table = result.container.querySelector('.ProseMirror');
|
29
29
|
expect(table.innerHTML).toBe(expectedOutput);
|
30
30
|
});
|
31
31
|
it('Change in table is returned as expected', async () => {
|
32
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>';
|
33
|
+
const inputData = '<table class="e-table"><tbody><tr class="e-text-top"><td scope="row">foo</td></tr></tbody></table>';
|
34
|
+
const expectedOutput = '<table class="e-table"><tbody><tr class="e-text-top"><td scope="row">bar</td></tr></tbody></table>';
|
35
35
|
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
36
36
|
await act(async () => {
|
37
37
|
(0, util_1.insertText)(await result.findByText('foo'), 'bar');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Table.test.js","sourceRoot":"","sources":["../../../__tests__/editor/Table.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAqE;AACrE,6EAAmD;AACnD,gGAAoF;AACpF,wCAA0C;AAC1C,qCAAkC;AAElC,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAm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","sourceRoot":"","sources":["../../../__tests__/editor/undoRedo.test.tsx"],"names":[],"mappings":""}
|
@@ -0,0 +1,61 @@
|
|
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 renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
|
8
|
+
const util_1 = require("../utils/util");
|
9
|
+
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
10
|
+
const prosemirror_1 = require("../utils/prosemirror");
|
11
|
+
const act = react_1.act;
|
12
|
+
describe('Undo/Redo', () => {
|
13
|
+
let cleanup;
|
14
|
+
let onContentChangeMock;
|
15
|
+
beforeEach(() => {
|
16
|
+
onContentChangeMock = jest.fn();
|
17
|
+
cleanup = (0, prosemirror_1.mockCreateRange)();
|
18
|
+
});
|
19
|
+
afterEach(() => {
|
20
|
+
if (cleanup) {
|
21
|
+
cleanup();
|
22
|
+
}
|
23
|
+
cleanup = null;
|
24
|
+
});
|
25
|
+
it('inserted text can be undone', async () => {
|
26
|
+
const inputData = '<p>Testiteksti</p>';
|
27
|
+
const expectedOutput = '<p>1234</p>';
|
28
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
29
|
+
await act(async () => {
|
30
|
+
(0, util_1.insertText)(await result.findByText('Testiteksti'), '1234');
|
31
|
+
});
|
32
|
+
expect(onContentChangeMock).toHaveBeenCalledTimes(1);
|
33
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
34
|
+
await act(async () => {
|
35
|
+
await user_event_1.default.click(await result.findByTitle('kumoa muutokset'));
|
36
|
+
});
|
37
|
+
expect(onContentChangeMock).toHaveBeenCalledTimes(2);
|
38
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(inputData, '');
|
39
|
+
});
|
40
|
+
it('undone text can be redo', async () => {
|
41
|
+
const inputData = '<p>Testiteksti</p>';
|
42
|
+
const expectedOutput = '<p>1234</p>';
|
43
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
44
|
+
await act(async () => {
|
45
|
+
(0, util_1.insertText)(await result.findByText('Testiteksti'), '1234');
|
46
|
+
});
|
47
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
48
|
+
expect(onContentChangeMock).toHaveBeenCalledTimes(1);
|
49
|
+
await act(async () => {
|
50
|
+
await user_event_1.default.click(await result.findByTitle('kumoa muutokset'));
|
51
|
+
});
|
52
|
+
expect(onContentChangeMock).toHaveBeenCalledTimes(2);
|
53
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(inputData, '');
|
54
|
+
await act(async () => {
|
55
|
+
await user_event_1.default.click(await result.findByTitle('toista muutokset'));
|
56
|
+
});
|
57
|
+
expect(onContentChangeMock).toHaveBeenCalledTimes(3);
|
58
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
59
|
+
});
|
60
|
+
});
|
61
|
+
//# sourceMappingURL=undoRedo.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"undoRedo.test.js","sourceRoot":"","sources":["../../../__tests__/editor/undoRedo.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAuD;AACvD,gGAAoF;AACpF,wCAA0C;AAC1C,6EAAmD;AACnD,sDAAsD;AAEtD,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QAC/B,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,SAA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