@digabi/exam-engine-core 23.23.1-alpha.0 → 23.24.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 (33) hide show
  1. package/dist/__tests__/playwright/results/MultiLineAnswer.test.d.ts.map +1 -0
  2. package/dist/__tests__/playwright/results/MultiLineAnswer.test.js +45 -0
  3. package/dist/__tests__/playwright/results/MultiLineAnswer.test.js.map +1 -0
  4. package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.d.ts +8 -0
  5. package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.d.ts.map +1 -0
  6. package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.js +51 -0
  7. package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.js.map +1 -0
  8. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  9. package/dist/components/grading/GradingAnswer.d.ts.map +1 -1
  10. package/dist/components/grading/GradingAnswer.js +3 -2
  11. package/dist/components/grading/GradingAnswer.js.map +1 -1
  12. package/dist/components/grading/editAnnotations.js +2 -2
  13. package/dist/components/grading/editAnnotations.js.map +1 -1
  14. package/dist/components/grading/largeImageDetector.js +4 -8
  15. package/dist/components/grading/largeImageDetector.js.map +1 -1
  16. package/dist/components/results/MultiLineAnswer.d.ts.map +1 -1
  17. package/dist/components/results/MultiLineAnswer.js +3 -2
  18. package/dist/components/results/MultiLineAnswer.js.map +1 -1
  19. package/dist/dom-utils.d.ts +2 -0
  20. package/dist/dom-utils.d.ts.map +1 -1
  21. package/dist/dom-utils.js +13 -0
  22. package/dist/dom-utils.js.map +1 -1
  23. package/dist/main-bundle.js +1 -1
  24. package/dist/main.css +1 -1
  25. package/dist/renderAnnotations.d.ts +0 -1
  26. package/dist/renderAnnotations.d.ts.map +1 -1
  27. package/dist/renderAnnotations.js +1 -14
  28. package/dist/renderAnnotations.js.map +1 -1
  29. package/package.json +2 -2
  30. package/dist/__tests__/results/MultiLineAnswer.test.d.ts.map +0 -1
  31. package/dist/__tests__/results/MultiLineAnswer.test.js +0 -56
  32. package/dist/__tests__/results/MultiLineAnswer.test.js.map +0 -1
  33. /package/dist/__tests__/{results → playwright/results}/MultiLineAnswer.test.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiLineAnswer.test.d.ts","sourceRoot":"","sources":["../../../../__tests__/playwright/results/MultiLineAnswer.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
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 = __importDefault(require("react"));
7
+ const experimental_ct_react_1 = require("@playwright/experimental-ct-react");
8
+ const MultiLineAnswer_story_1 = require("../stories/results/MultiLineAnswer.story");
9
+ const textAnnotationScore = {
10
+ questionId: 1,
11
+ answerId: 1,
12
+ pregrading: {
13
+ score: 1,
14
+ annotations: [{ type: 'text', startIndex: 6, length: 5, message: 'Text annotation' }]
15
+ }
16
+ };
17
+ experimental_ct_react_1.test.describe('<MultiLineAnswer /> image opening', () => {
18
+ (0, experimental_ct_react_1.test)('adds a full size image link for downscaled images', async ({ mount }) => {
19
+ const component = await mount(react_1.default.createElement(MultiLineAnswer_story_1.MultiLineAnswerStory, { imageWidth: 1600 }));
20
+ const src = await component.locator('img').evaluate((img) => img.src);
21
+ await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveAttribute('target', '_blank');
22
+ await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveAttribute('href', src);
23
+ });
24
+ (0, experimental_ct_react_1.test)('does not add a full size image link for images rendered at natural size', async ({ mount }) => {
25
+ const component = await mount(react_1.default.createElement(MultiLineAnswer_story_1.MultiLineAnswerStory, { imageWidth: 400 }));
26
+ // we need to wait for the image to load, otherwise the assertion would be immediately true
27
+ await waitForImageLoad(component.locator('img'));
28
+ await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image')).toHaveCount(0);
29
+ });
30
+ (0, experimental_ct_react_1.test)('keeps annotation marks out of the full size image wrapper', async ({ mount }) => {
31
+ const component = await mount(react_1.default.createElement(MultiLineAnswer_story_1.MultiLineAnswerStory, { imageWidth: 1600, score: textAnnotationScore }));
32
+ await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveCount(1);
33
+ await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image mark')).toHaveCount(0);
34
+ await (0, experimental_ct_react_1.expect)(component.locator('mark')).toContainText('World');
35
+ });
36
+ });
37
+ async function waitForImageLoad(image) {
38
+ await image.evaluate((img) => {
39
+ if (img.complete) {
40
+ return;
41
+ }
42
+ return new Promise(resolve => img.addEventListener('load', () => resolve(), { once: true }));
43
+ });
44
+ }
45
+ //# sourceMappingURL=MultiLineAnswer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiLineAnswer.test.js","sourceRoot":"","sources":["../../../../__tests__/playwright/results/MultiLineAnswer.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,6EAAgE;AAGhE,oFAA+E;AAE/E,MAAM,mBAAmB,GAAU;IACjC,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE;QACV,KAAK,EAAE,CAAC;QACR,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;KACtF;CACF,CAAA;AAED,4BAAI,CAAC,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACtD,IAAA,4BAAI,EAAC,mDAAmD,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAC5E,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,8BAAC,4CAAoB,IAAC,UAAU,EAAE,IAAI,GAAI,CAAC,CAAA;QACzE,MAAM,GAAG,GAAG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,CAAA;QACvE,MAAM,IAAA,8BAAM,EAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,KAAK,UAAU,gBAAgB,CAAC,KAAc;IAC5C,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAqB,EAAE,EAAE;QAC7C,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACjB,OAAM;QACR,CAAC;QACD,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACpG,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { Score } from '../../../../src';
3
+ import '../../../../src/css/main.less';
4
+ export declare const MultiLineAnswerStory: React.FC<{
5
+ imageWidth: number;
6
+ score?: Score;
7
+ }>;
8
+ //# sourceMappingURL=MultiLineAnswer.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiLineAnswer.story.d.ts","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/results/MultiLineAnswer.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAItC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,+BAA+B,CAAA;AAStC,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAShF,CAAA"}
@@ -0,0 +1,51 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.MultiLineAnswerStory = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_i18next_1 = require("react-i18next");
39
+ const MultiLineAnswer_1 = require("../../../../src/components/results/MultiLineAnswer");
40
+ const i18n_1 = require("../../../../src/i18n");
41
+ require("../../../../src/css/main.less");
42
+ const imageSrc = (width) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="100"><rect width="${width}" height="100" fill="green"/></svg>`)}`;
43
+ const answerWithImage = (imageWidth) => `Hello<img src="${imageSrc(imageWidth)}" />World`;
44
+ const MultiLineAnswerStory = ({ imageWidth, score }) => {
45
+ const i18n = (0, react_1.useMemo)(() => (0, i18n_1.initI18n)('fi-FI'), []);
46
+ return (react_1.default.createElement(react_i18next_1.I18nextProvider, { i18n: i18n },
47
+ react_1.default.createElement("div", { className: "e-results" },
48
+ react_1.default.createElement(MultiLineAnswer_1.MultiLineAnswer, { type: "rich-text", value: answerWithImage(imageWidth), score: score }))));
49
+ };
50
+ exports.MultiLineAnswerStory = MultiLineAnswerStory;
51
+ //# sourceMappingURL=MultiLineAnswer.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiLineAnswer.story.js","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/results/MultiLineAnswer.story.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsC;AACtC,iDAA+C;AAC/C,wFAAoF;AACpF,+CAA+C;AAE/C,yCAAsC;AAEtC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CACjC,sBAAsB,kBAAkB,CACtC,kDAAkD,KAAK,+BAA+B,KAAK,qCAAqC,CACjI,EAAE,CAAA;AAEL,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,kBAAkB,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAA;AAE1F,MAAM,oBAAoB,GAAoD,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7G,MAAM,IAAI,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,eAAQ,EAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IACjD,OAAO,CACL,8BAAC,+BAAe,IAAC,IAAI,EAAE,IAAI;QACzB,uCAAK,SAAS,EAAC,WAAW;YACxB,8BAAC,iCAAe,IAAC,IAAI,EAAC,WAAW,EAAC,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,GAAI,CAClF,CACU,CACnB,CAAA;AACH,CAAC,CAAA;AATY,QAAA,oBAAoB,wBAShC"}