@digabi/exam-engine-core 22.0.6-alpha.0 → 22.0.7-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=undoRedo.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undoRedo.test.d.ts","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,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAA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