@digabi/exam-engine-core 22.1.6-alpha.0 → 22.1.6-alpha.1

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.
Files changed (62) hide show
  1. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts +2 -0
  2. package/dist/__tests__/EditableGradingInstructionLocalization.test.d.ts.map +1 -0
  3. package/dist/__tests__/EditableGradingInstructionLocalization.test.js +75 -0
  4. package/dist/__tests__/EditableGradingInstructionLocalization.test.js.map +1 -0
  5. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  6. package/dist/components/Localization.d.ts +5 -0
  7. package/dist/components/Localization.d.ts.map +1 -0
  8. package/dist/components/Localization.js +9 -0
  9. package/dist/components/Localization.js.map +1 -0
  10. package/dist/components/context/AttachmentContext.d.ts.map +1 -1
  11. package/dist/components/context/ExamContext.d.ts.map +1 -1
  12. package/dist/components/context/QuestionContext.d.ts.map +1 -1
  13. package/dist/components/context/ResultsContext.d.ts.map +1 -1
  14. package/dist/components/context/SectionContext.d.ts.map +1 -1
  15. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
  16. package/dist/components/grading-instructions/EditableGradingInstruction.js +3 -2
  17. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
  18. package/dist/components/grading-instructions/GradingInstruction.d.ts +7 -0
  19. package/dist/components/grading-instructions/GradingInstruction.d.ts.map +1 -0
  20. package/dist/components/grading-instructions/GradingInstruction.js +9 -0
  21. package/dist/components/grading-instructions/GradingInstruction.js.map +1 -0
  22. package/dist/components/grading-instructions/GradingInstructions.d.ts +1 -1
  23. package/dist/components/grading-instructions/editor/AttributeToggleButton.d.ts +9 -0
  24. package/dist/components/grading-instructions/editor/AttributeToggleButton.d.ts.map +1 -0
  25. package/dist/components/grading-instructions/editor/AttributeToggleButton.js +53 -0
  26. package/dist/components/grading-instructions/editor/AttributeToggleButton.js.map +1 -0
  27. package/dist/components/grading-instructions/editor/CurrentElement.d.ts +2 -0
  28. package/dist/components/grading-instructions/editor/CurrentElement.d.ts.map +1 -0
  29. package/dist/components/grading-instructions/editor/CurrentElement.js +8 -0
  30. package/dist/components/grading-instructions/editor/CurrentElement.js.map +1 -0
  31. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts +7 -0
  32. package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts.map +1 -0
  33. package/dist/components/grading-instructions/editor/CurrentLocalization.js +13 -0
  34. package/dist/components/grading-instructions/editor/CurrentLocalization.js.map +1 -0
  35. package/dist/components/grading-instructions/editor/Localization.d.ts +3 -0
  36. package/dist/components/grading-instructions/editor/Localization.d.ts.map +1 -0
  37. package/dist/components/grading-instructions/editor/Localization.js +36 -0
  38. package/dist/components/grading-instructions/editor/Localization.js.map +1 -0
  39. package/dist/components/grading-instructions/editor/LocalizationButtons.d.ts +6 -0
  40. package/dist/components/grading-instructions/editor/LocalizationButtons.d.ts.map +1 -0
  41. package/dist/components/grading-instructions/editor/LocalizationButtons.js +14 -0
  42. package/dist/components/grading-instructions/editor/LocalizationButtons.js.map +1 -0
  43. package/dist/components/grading-instructions/editor/localizatio.d.ts +3 -0
  44. package/dist/components/grading-instructions/editor/localizatio.d.ts.map +1 -0
  45. package/dist/components/grading-instructions/editor/localizatio.js +36 -0
  46. package/dist/components/grading-instructions/editor/localizatio.js.map +1 -0
  47. package/dist/components/grading-instructions/editor/localizationSpan.d.ts +3 -0
  48. package/dist/components/grading-instructions/editor/localizationSpan.d.ts.map +1 -0
  49. package/dist/components/grading-instructions/editor/localizationSpan.js +36 -0
  50. package/dist/components/grading-instructions/editor/localizationSpan.js.map +1 -0
  51. package/dist/components/grading-instructions/editor/spanWithPath.d.ts +3 -0
  52. package/dist/components/grading-instructions/editor/spanWithPath.d.ts.map +1 -0
  53. package/dist/components/grading-instructions/editor/spanWithPath.js +24 -0
  54. package/dist/components/grading-instructions/editor/spanWithPath.js.map +1 -0
  55. package/dist/components/grading-instructions/editor/util.d.ts +6 -0
  56. package/dist/components/grading-instructions/editor/util.d.ts.map +1 -0
  57. package/dist/components/grading-instructions/editor/util.js +10 -0
  58. package/dist/components/grading-instructions/editor/util.js.map +1 -0
  59. package/dist/main-bundle.js +1 -1
  60. package/dist/main-bundle.js.LICENSE.txt +1 -1
  61. package/dist/main.css +1 -1
  62. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EditableGradingInstructionLocalization.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditableGradingInstructionLocalization.test.d.ts","sourceRoot":"","sources":["../../__tests__/EditableGradingInstructionLocalization.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const renderEditableGradingInstruction_1 = require("./utils/renderEditableGradingInstruction");
5
+ const util_1 = require("./utils/util");
6
+ const prosemirror_1 = require("./utils/prosemirror");
7
+ const act = react_1.act;
8
+ describe('EditableGradingInstructionLocalization', () => {
9
+ let cleanup;
10
+ let onContentChangeMock;
11
+ beforeEach(() => {
12
+ onContentChangeMock = jest.fn();
13
+ cleanup = (0, prosemirror_1.mockCreateRange)();
14
+ });
15
+ afterEach(() => {
16
+ if (cleanup) {
17
+ cleanup();
18
+ }
19
+ cleanup = null;
20
+ });
21
+ it('preserves localization tags with e-localization attribute on save', async () => {
22
+ // e-localization attribute is added on mastering exam
23
+ const inputData = '<p><e:localization lang="sv-FI" exam-type="hearing-impaired" e-localization="1">placeholder</e:localization></p>';
24
+ const expectedOutput = '<p><e:localization lang="sv-FI" exam-type="hearing-impaired">lokalisaatio</e:localization></p>';
25
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
26
+ await act(async () => {
27
+ (0, util_1.insertText)(await result.findByText('placeholder'), 'lokalisaatio');
28
+ });
29
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
30
+ });
31
+ it('localization tags without e-localization attribute are ignored', async () => {
32
+ const inputData = '<p><e:localization lang="sv-FI" exam-type="hearing-impaired">placeholder</e:localization></p>';
33
+ const expectedOutput = '<p>lokalisaatio</p>';
34
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
35
+ await act(async () => {
36
+ (0, util_1.insertText)(await result.findByText('placeholder'), 'lokalisaatio');
37
+ });
38
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
39
+ });
40
+ it("removes localization's e-localization and hidden attributes on save", async () => {
41
+ const inputData = '<p>Tämä <e:localization exam-type="visually-impaired" e-localization="1" hidden="hidden">on</e:localization> piilossa</p>';
42
+ const expectedOutput = '<p>Tämä <e:localization exam-type="visually-impaired">ei ole</e:localization> piilossa</p>';
43
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
44
+ await act(async () => {
45
+ (0, util_1.insertText)(await result.findByText('on'), 'ei ole');
46
+ });
47
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
48
+ });
49
+ it('saves all grading instructions as a whole regardless which localization is edited', async () => {
50
+ const inputData = `
51
+ <p>Not localized</p>
52
+ <p>
53
+ <e:localization e-localization="1">Localized without attributes</e:localization>
54
+ <e:localization e-localization="1" lang="fi-FI">Localized with language</e:localization>
55
+ <e:localization e-localization="1" exam-type="visually-impaired">Localized with exam-type</e:localization>
56
+ <e:localization e-localization="1" lang="sv-FI" exam-type="visually-impaired">Localized with language and exam-type</e:localization>
57
+ </p>
58
+ `.replace(/\n/g, '');
59
+ const expectedOutput = `
60
+ <p>Not localized</p>
61
+ <p>
62
+ <e:localization>Localized without attributes</e:localization>
63
+ <e:localization lang="fi-FI">Localized with language</e:localization>
64
+ <e:localization exam-type="visually-impaired">Localized with examType</e:localization>
65
+ <e:localization lang="sv-FI" exam-type="visually-impaired">Localized with language and exam-type</e:localization>
66
+ </p>
67
+ `.replace(/\n/g, '');
68
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
69
+ await act(async () => {
70
+ (0, util_1.insertText)(await result.findByText('Localized with exam-type'), 'Localized with examType');
71
+ });
72
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
73
+ });
74
+ });
75
+ //# sourceMappingURL=EditableGradingInstructionLocalization.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditableGradingInstructionLocalization.test.js","sourceRoot":"","sources":["../../__tests__/EditableGradingInstructionLocalization.test.tsx"],"names":[],"mappings":";;AAAA,kDAAuD;AACvD,+FAAmF;AACnF,uCAAyC;AACzC,qDAAqD;AAErD,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACtD,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,mEAAmE,EAAE,KAAK,IAAI,EAAE;QACjF,sDAAsD;QACtD,MAAM,SAAS,GACb,kHAAkH,CAAA;QACpH,MAAM,cAAc,GAClB,gGAAgG,CAAA;QAClG,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,cAAc,CAAC,CAAA;QACpE,CAAC,CAAC,CAAA;QACF,MAAM,CAA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