@digabi/exam-engine-core 23.2.3-alpha.0 → 23.2.3-beta.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.
Files changed (55) hide show
  1. package/dist/__tests__/playwright/Annotations.test.d.ts +2 -0
  2. package/dist/__tests__/playwright/Annotations.test.d.ts.map +1 -0
  3. package/dist/__tests__/playwright/Annotations.test.js +156 -0
  4. package/dist/__tests__/playwright/Annotations.test.js.map +1 -0
  5. package/dist/__tests__/playwright/attachments/Attachments.test.d.ts +2 -0
  6. package/dist/__tests__/playwright/attachments/Attachments.test.d.ts.map +1 -0
  7. package/dist/__tests__/playwright/attachments/Attachments.test.js +30 -0
  8. package/dist/__tests__/playwright/attachments/Attachments.test.js.map +1 -0
  9. package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.js +51 -24
  10. package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.js.map +1 -1
  11. package/dist/__tests__/playwright/exam/Exam.test.d.ts +2 -0
  12. package/dist/__tests__/playwright/exam/Exam.test.d.ts.map +1 -0
  13. package/dist/__tests__/playwright/exam/Exam.test.js +30 -0
  14. package/dist/__tests__/playwright/exam/Exam.test.js.map +1 -0
  15. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.d.ts +2 -0
  16. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.d.ts.map +1 -0
  17. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js +30 -0
  18. package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js.map +1 -0
  19. package/dist/__tests__/playwright/stories/Annotations.story.d.ts +12 -0
  20. package/dist/__tests__/playwright/stories/Annotations.story.d.ts.map +1 -0
  21. package/dist/__tests__/playwright/stories/Annotations.story.js +22 -0
  22. package/dist/__tests__/playwright/stories/Annotations.story.js.map +1 -0
  23. package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts +13 -0
  24. package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts.map +1 -0
  25. package/dist/__tests__/playwright/stories/attachments/Attachments.story.js +17 -0
  26. package/dist/__tests__/playwright/stories/attachments/Attachments.story.js.map +1 -0
  27. package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts +12 -0
  28. package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts.map +1 -0
  29. package/dist/__tests__/playwright/stories/exam/Exam.story.js +56 -0
  30. package/dist/__tests__/playwright/stories/exam/Exam.story.js.map +1 -0
  31. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts +13 -0
  32. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts.map +1 -0
  33. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.js +16 -0
  34. package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.js.map +1 -0
  35. package/dist/__tests__/playwright/utils/utils.d.ts +5 -0
  36. package/dist/__tests__/playwright/utils/utils.d.ts.map +1 -0
  37. package/dist/__tests__/playwright/utils/utils.js +36 -0
  38. package/dist/__tests__/playwright/utils/utils.js.map +1 -0
  39. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  40. package/dist/components/context/AnnotationProvider.d.ts.map +1 -1
  41. package/dist/components/context/AnnotationProvider.js +1 -2
  42. package/dist/components/context/AnnotationProvider.js.map +1 -1
  43. package/dist/components/exam/DNDAnswerContainer.d.ts.map +1 -1
  44. package/dist/components/exam/DNDAnswerContainer.js +2 -2
  45. package/dist/components/exam/DNDAnswerContainer.js.map +1 -1
  46. package/dist/components/exam/multipleContainersKeyboardCoordinates.d.ts.map +1 -1
  47. package/dist/components/exam/multipleContainersKeyboardCoordinates.js +0 -8
  48. package/dist/components/exam/multipleContainersKeyboardCoordinates.js.map +1 -1
  49. package/dist/components/shared/AnnotationMark.js +1 -1
  50. package/dist/components/shared/AnnotationMark.js.map +1 -1
  51. package/dist/main-bundle.js +3 -3
  52. package/dist/main.css +1 -1
  53. package/dist/types/Score.d.ts +0 -2
  54. package/dist/types/Score.d.ts.map +1 -1
  55. package/package.json +2 -2
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.ExamStory = void 0;
40
+ const react_1 = __importDefault(require("react"));
41
+ const Exam_1 = __importStar(require("../../../../src/components/exam/Exam"));
42
+ const ExamComponentWrapper_1 = require("../../utils/ExamComponentWrapper");
43
+ const parseExam_1 = __importDefault(require("../../../../src/parser/parseExam"));
44
+ const examServerApi_1 = require("../../../examServerApi");
45
+ const ExamStory = ({ masteredExam, annotations, onClickAnnotation, onSaveAnnotation }) => {
46
+ const doc = (0, parseExam_1.default)(masteredExam.xml, true);
47
+ return (react_1.default.createElement(ExamComponentWrapper_1.ExamComponentWrapper, { doc: doc, resolveAttachment: (filename) => `/${masteredExam.examCode}/attachments/${filename}` },
48
+ react_1.default.createElement(Exam_1.default, { doc: doc, renderChildNodes: Exam_1.renderChildNodes, annotations: annotations, onClickAnnotation: onClickAnnotation, onSaveAnnotation: onSaveAnnotation, resolveAttachment: (filename) => `/${masteredExam.examCode}/attachments/${filename}`, answers: [], attachmentsURL: "/attachments", casStatus: "forbidden", examServerApi: examServerApi_1.examServerApi, studentName: "[Kokelaan Nimi]", showUndoView: false, undoViewProps: {
49
+ questionId: 0,
50
+ title: '',
51
+ close: () => undefined,
52
+ restoreAnswer: () => undefined
53
+ } })));
54
+ };
55
+ exports.ExamStory = ExamStory;
56
+ //# sourceMappingURL=Exam.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exam.story.js","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/exam/Exam.story.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AAEzB,6EAA6E;AAC7E,2EAAuE;AACvE,iFAAwD;AAExD,0DAAsD;AAS/C,MAAM,SAAS,GAA6B,CAAC,EAClD,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACjB,EAAE,EAAE;IACH,MAAM,GAAG,GAAG,IAAA,mBAAS,EAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC7C,OAAO,CACL,8BAAC,2CAAoB,IACnB,GAAG,EAAE,GAAG,EACR,iBAAiB,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,QAAQ,gBAAgB,QAAQ,EAAE;QAE5F,8BAAC,cAAI,IACH,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,uBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,QAAQ,gBAAgB,QAAQ,EAAE,EAC5F,OAAO,EAAE,EAAE,EACX,cAAc,EAAC,cAAc,EAC7B,SAAS,EAAC,WAAW,EACrB,aAAa,EAAE,6BAAa,EAC5B,WAAW,EAAC,iBAAiB,EAC7B,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE;gBACb,UAAU,EAAE,CAAC;gBACb,KAAK,EAAE,EAAE;gBACT,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;gBACtB,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS;aAC/B,GACD,CACmB,CACxB,CAAA;AACH,CAAC,CAAA;AAlCY,QAAA,SAAS,aAkCrB"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { MasteringResult } from '@digabi/exam-engine-mastering';
3
+ import { ExamAnnotation, NewExamAnnotation, RenderableAnnotation } from '../../../../src';
4
+ import '../../../../src/css/main.less';
5
+ interface GradingInstructionsStoryProps {
6
+ masteredExam: MasteringResult;
7
+ annotations?: ExamAnnotation[];
8
+ onClickAnnotation?: (e: React.MouseEvent<HTMLElement, MouseEvent>, annotation: RenderableAnnotation) => void;
9
+ onSaveAnnotation?: (annotation: NewExamAnnotation, comment: string) => void;
10
+ }
11
+ export declare const GradingInstructionStory: React.FC<GradingInstructionsStoryProps>;
12
+ export {};
13
+ //# sourceMappingURL=GradingInstructions.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GradingInstructions.story.d.ts","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/grading-intructions/GradingInstructions.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAG/D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACzF,OAAO,+BAA+B,CAAA;AAEtC,UAAU,6BAA6B;IACrC,YAAY,EAAE,eAAe,CAAA;IAC7B,WAAW,CAAC,EAAE,cAAc,EAAE,CAAA;IAC9B,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC5G,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5E;AAED,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAkB3E,CAAA"}
@@ -0,0 +1,16 @@
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
+ exports.GradingInstructionStory = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const parseExam_1 = __importDefault(require("../../../../src/parser/parseExam"));
9
+ const GradingInstructions_1 = __importDefault(require("../../../../src/components/grading-instructions/GradingInstructions"));
10
+ require("../../../../src/css/main.less");
11
+ const GradingInstructionStory = ({ masteredExam, annotations, onClickAnnotation, onSaveAnnotation }) => {
12
+ const doc = (0, parseExam_1.default)(masteredExam.xml, true);
13
+ return (react_1.default.createElement(GradingInstructions_1.default, { doc: doc, resolveAttachment: (filename) => `/${masteredExam.examCode}/attachments/${filename}`, answers: [], attachmentsURL: "/attachments", annotations: annotations, onClickAnnotation: onClickAnnotation, onSaveAnnotation: onSaveAnnotation }));
14
+ };
15
+ exports.GradingInstructionStory = GradingInstructionStory;
16
+ //# sourceMappingURL=GradingInstructions.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GradingInstructions.story.js","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/grading-intructions/GradingInstructions.story.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEzB,iFAAwD;AACxD,8HAAqG;AAErG,yCAAsC;AAS/B,MAAM,uBAAuB,GAA4C,CAAC,EAC/E,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACjB,EAAE,EAAE;IACH,MAAM,GAAG,GAAG,IAAA,mBAAS,EAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC7C,OAAO,CACL,8BAAC,6BAAmB,IAClB,GAAG,EAAE,GAAG,EACR,iBAAiB,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,QAAQ,gBAAgB,QAAQ,EAAE,EAC5F,OAAO,EAAE,EAAE,EACX,cAAc,EAAC,cAAc,EAC7B,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAA;AACH,CAAC,CAAA;AAlBY,QAAA,uBAAuB,2BAkBnC"}
@@ -0,0 +1,5 @@
1
+ import { Locator, Page } from '@playwright/test';
2
+ import { MasteringResult } from '@digabi/exam-engine-mastering';
3
+ export declare function setupMasteredExam(subject?: string): Promise<MasteringResult>;
4
+ export declare function annotate(locator: Locator, page: Page): Promise<void>;
5
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../__tests__/playwright/utils/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAA6C,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE1G,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,MAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAQxF;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,iBAc1D"}
@@ -0,0 +1,36 @@
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
+ exports.setupMasteredExam = setupMasteredExam;
7
+ exports.annotate = annotate;
8
+ const exam_engine_exams_1 = require("@digabi/exam-engine-exams");
9
+ const promises_1 = require("fs/promises");
10
+ const path_1 = __importDefault(require("path"));
11
+ const exam_engine_mastering_1 = require("@digabi/exam-engine-mastering");
12
+ async function setupMasteredExam(subject = 'SC') {
13
+ const examPath = (0, exam_engine_exams_1.resolveExam)(`${subject}/${subject}.xml`);
14
+ const resolveAttachment = (filename) => path_1.default.resolve(path_1.default.dirname(examPath), 'attachments', filename);
15
+ const examXml = await (0, promises_1.readFile)(examPath, 'utf-8');
16
+ const [masteredExam] = await (0, exam_engine_mastering_1.masterExam)(examXml, () => '', (0, exam_engine_mastering_1.getMediaMetadataFromLocalFile)(resolveAttachment), {
17
+ removeCorrectAnswers: true
18
+ });
19
+ return masteredExam;
20
+ }
21
+ async function annotate(locator, page) {
22
+ await locator.scrollIntoViewIfNeeded(); // Scroll the element into view
23
+ const box = await locator.boundingBox();
24
+ if (!box)
25
+ throw new Error('Bounding box not found');
26
+ const startX = box.x + 1;
27
+ const startY = box.y + 1;
28
+ const endX = box.x + 200; // Move further to the right to select text
29
+ const endY = startY;
30
+ // Simulate dragging the mouse to select text
31
+ await page.mouse.move(startX, startY);
32
+ await page.mouse.down();
33
+ await page.mouse.move(endX, endY);
34
+ await page.mouse.up();
35
+ }
36
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../__tests__/playwright/utils/utils.ts"],"names":[],"mappings":";;;;;AAMA,8CAQC;AAED,4BAcC;AA9BD,iEAAuD;AACvD,0CAAsC;AAEtC,gDAAuB;AACvB,yEAA0G;AAEnG,KAAK,UAAU,i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