@digabi/exam-engine-core 22.0.5-editor-ee-to-em.0 → 22.0.7-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/dist/__tests__/editor/undoRedo.test.d.ts +2 -0
  2. package/dist/__tests__/editor/undoRedo.test.d.ts.map +1 -0
  3. package/dist/__tests__/editor/undoRedo.test.js +61 -0
  4. package/dist/__tests__/editor/undoRedo.test.js.map +1 -0
  5. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  6. package/dist/components/context/GradingInstructionContext.d.ts +11 -6
  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/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
  10. package/dist/components/grading-instructions/AnswerGradingInstruction.js +3 -4
  11. package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
  12. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
  13. package/dist/components/grading-instructions/EditableGradingInstruction.js +18 -3
  14. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
  15. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +1 -1
  16. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -1
  17. package/dist/components/grading-instructions/GradingInstructionProvider.js +4 -1
  18. package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
  19. package/dist/components/grading-instructions/GradingInstructions.d.ts +2 -6
  20. package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
  21. package/dist/components/grading-instructions/GradingInstructions.js +3 -2
  22. package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
  23. package/dist/components/grading-instructions/editor/FormulaPopup.js +5 -5
  24. package/dist/components/grading-instructions/editor/FormulaPopup.js.map +1 -1
  25. package/dist/components/grading-instructions/editor/UndoRedoButtons.d.ts +6 -0
  26. package/dist/components/grading-instructions/editor/UndoRedoButtons.d.ts.map +1 -0
  27. package/dist/components/grading-instructions/editor/UndoRedoButtons.js +19 -0
  28. package/dist/components/grading-instructions/editor/UndoRedoButtons.js.map +1 -0
  29. package/dist/main-bundle.js +1 -1
  30. package/dist/main.css +1 -1
  31. package/package.json +12 -2
  32. package/dist/__tests__/EditableGradingInstruction.test.d.ts +0 -2
  33. package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +0 -1
  34. package/dist/__tests__/EditableGradingInstruction.test.js +0 -174
  35. package/dist/__tests__/EditableGradingInstruction.test.js.map +0 -1
  36. package/dist/__tests__/FormatButton.test.d.ts +0 -2
  37. package/dist/__tests__/FormatButton.test.d.ts.map +0 -1
  38. package/dist/__tests__/FormatButton.test.js +0 -94
  39. package/dist/__tests__/FormatButton.test.js.map +0 -1
  40. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts +0 -4
  41. package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts.map +0 -1
  42. package/dist/components/grading-instructions/editor/schemas/image-schema.js +0 -47
  43. package/dist/components/grading-instructions/editor/schemas/image-schema.js.map +0 -1
  44. package/dist/components/grading-instructions/localization.d.ts +0 -3
  45. package/dist/components/grading-instructions/localization.d.ts.map +0 -1
  46. package/dist/components/grading-instructions/localization.js +0 -41
  47. package/dist/components/grading-instructions/localization.js.map +0 -1
@@ -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,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,SAAS,GAAG,oBAAoB,CAAA;QACtC,MAAM,cAAc,GAAG,aAAa,CAAA;QACpC,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,aAAa,CAAC,EAAE,MAAM,CAAC,CAAA;QAC5D,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,CA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