@digabi/exam-engine-core 23.23.0 → 23.23.1-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.
- package/dist/__tests__/playwright/results/MultiLineAnswer.test.d.ts +2 -0
- package/dist/__tests__/playwright/results/MultiLineAnswer.test.d.ts.map +1 -0
- package/dist/__tests__/playwright/results/MultiLineAnswer.test.js +38 -0
- package/dist/__tests__/playwright/results/MultiLineAnswer.test.js.map +1 -0
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.d.ts +8 -0
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.d.ts.map +1 -0
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.js +68 -0
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.js.map +1 -0
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/grading/GradingAnswer.d.ts.map +1 -1
- package/dist/components/grading/GradingAnswer.js +3 -2
- package/dist/components/grading/GradingAnswer.js.map +1 -1
- package/dist/components/grading/editAnnotations.js +2 -2
- package/dist/components/grading/editAnnotations.js.map +1 -1
- package/dist/components/grading/largeImageDetector.d.ts.map +1 -1
- package/dist/components/grading/largeImageDetector.js +4 -4
- package/dist/components/grading/largeImageDetector.js.map +1 -1
- package/dist/components/results/MultiLineAnswer.d.ts.map +1 -1
- package/dist/components/results/MultiLineAnswer.js +5 -0
- package/dist/components/results/MultiLineAnswer.js.map +1 -1
- package/dist/dom-utils.d.ts +2 -0
- package/dist/dom-utils.d.ts.map +1 -1
- package/dist/dom-utils.js +13 -0
- package/dist/dom-utils.js.map +1 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +10 -20
- package/dist/i18n/index.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/dist/renderAnnotations.d.ts +0 -1
- package/dist/renderAnnotations.d.ts.map +1 -1
- package/dist/renderAnnotations.js +1 -14
- package/dist/renderAnnotations.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiLineAnswer.test.d.ts","sourceRoot":"","sources":["../../../../__tests__/playwright/results/MultiLineAnswer.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
experimental_ct_react_1.test.describe('<MultiLineAnswer /> image opening', () => {
|
|
10
|
+
(0, experimental_ct_react_1.test)('adds a full size image link for downscaled images', async ({ mount }) => {
|
|
11
|
+
const component = await mount(react_1.default.createElement(MultiLineAnswer_story_1.MultiLineAnswerStory, { width: 80 }));
|
|
12
|
+
const src = await component.locator('img').getAttribute('src');
|
|
13
|
+
(0, experimental_ct_react_1.expect)(src).not.toBeNull();
|
|
14
|
+
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveAttribute('target', '_blank');
|
|
15
|
+
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveAttribute('href', src);
|
|
16
|
+
});
|
|
17
|
+
(0, experimental_ct_react_1.test)('does not add a full size image link for images rendered at natural size', async ({ mount }) => {
|
|
18
|
+
const component = await mount(react_1.default.createElement(MultiLineAnswer_story_1.MultiLineAnswerStory, { width: 240 }));
|
|
19
|
+
await waitForImageLoad(component.locator('img'));
|
|
20
|
+
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image')).toHaveCount(0);
|
|
21
|
+
});
|
|
22
|
+
(0, experimental_ct_react_1.test)('keeps full size image controls out of delayed annotation rendering', async ({ mount }) => {
|
|
23
|
+
const component = await mount(react_1.default.createElement(MultiLineAnswer_story_1.MultiLineAnswerDelayedScoreStory, null));
|
|
24
|
+
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveCount(1);
|
|
25
|
+
await component.getByRole('button', { name: 'Add score' }).click();
|
|
26
|
+
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image mark')).toHaveCount(0);
|
|
27
|
+
await (0, experimental_ct_react_1.expect)(component.locator('mark')).toContainText('World');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
async function waitForImageLoad(image) {
|
|
31
|
+
await image.evaluate((img) => {
|
|
32
|
+
if (img.complete) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
return new Promise(resolve => img.addEventListener('load', () => resolve(), { once: true }));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# 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;AAEhE,oFAAiH;AAEjH,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,KAAK,EAAE,EAAE,GAAI,CAAC,CAAA;QAClE,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;QAC9D,IAAA,8BAAM,EAAC,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;QAE1B,MAAM,IAAA,8BAAM,EAAC,SAAS,CAAC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E,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 '../../../../src/css/main.less';
|
|
3
|
+
export declare const imageSrc: string;
|
|
4
|
+
export declare const MultiLineAnswerStory: React.FC<{
|
|
5
|
+
width: number;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const MultiLineAnswerDelayedScoreStory: React.FC;
|
|
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,KAA4B,MAAM,OAAO,CAAA;AAKhD,OAAO,+BAA+B,CAAA;AAEtC,eAAO,MAAM,QAAQ,QAElB,CAAA;AAIH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAS5D,CAAA;AAED,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAcpD,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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.MultiLineAnswerDelayedScoreStory = exports.MultiLineAnswerStory = exports.imageSrc = 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
|
+
exports.imageSrc = `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100"><rect width="200" height="100" fill="green"/></svg>')}`;
|
|
43
|
+
const answerWithImage = `Hello<img src="${exports.imageSrc}" />World`;
|
|
44
|
+
const MultiLineAnswerStory = ({ width }) => {
|
|
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", style: { width } },
|
|
48
|
+
react_1.default.createElement(MultiLineAnswer_1.MultiLineAnswer, { type: "rich-text", value: answerWithImage }))));
|
|
49
|
+
};
|
|
50
|
+
exports.MultiLineAnswerStory = MultiLineAnswerStory;
|
|
51
|
+
const MultiLineAnswerDelayedScoreStory = () => {
|
|
52
|
+
const i18n = (0, react_1.useMemo)(() => (0, i18n_1.initI18n)('fi-FI'), []);
|
|
53
|
+
const [score, setScore] = (0, react_1.useState)();
|
|
54
|
+
return (react_1.default.createElement(react_i18next_1.I18nextProvider, { i18n: i18n },
|
|
55
|
+
react_1.default.createElement("div", { className: "e-results", style: { width: 80 } },
|
|
56
|
+
react_1.default.createElement("button", { type: "button", onClick: () => setScore(textAnnotationScore) }, "Add score"),
|
|
57
|
+
react_1.default.createElement(MultiLineAnswer_1.MultiLineAnswer, { type: "rich-text", value: answerWithImage, score: score }))));
|
|
58
|
+
};
|
|
59
|
+
exports.MultiLineAnswerDelayedScoreStory = MultiLineAnswerDelayedScoreStory;
|
|
60
|
+
const textAnnotationScore = {
|
|
61
|
+
questionId: 1,
|
|
62
|
+
answerId: 1,
|
|
63
|
+
pregrading: {
|
|
64
|
+
score: 1,
|
|
65
|
+
annotations: [{ type: 'text', startIndex: 6, length: 5, message: 'Text annotation' }]
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//# 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,+CAAgD;AAChD,iDAA+C;AAC/C,wFAAoF;AACpF,+CAA+C;AAE/C,yCAAsC;AAEzB,QAAA,QAAQ,GAAG,sBAAsB,kBAAkB,CAC9D,sHAAsH,CACvH,EAAE,CAAA;AAEH,MAAM,eAAe,GAAG,kBAAkB,gBAAQ,WAAW,CAAA;AAEtD,MAAM,oBAAoB,GAAgC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7E,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,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE;YACzC,8BAAC,iCAAe,IAAC,IAAI,EAAC,WAAW,EAAC,KAAK,EAAE,eAAe,GAAI,CACxD,CACU,CACnB,CAAA;AACH,CAAC,CAAA;AATY,QAAA,oBAAoB,wBAShC;AAEM,MAAM,gCAAgC,GAAa,GAAG,EAAE;IAC7D,MAAM,IAAI,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,eAAQ,EAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,GAAqB,CAAA;IAEvD,OAAO,CACL,8BAAC,+BAAe,IAAC,IAAI,EAAE,IAAI;QACzB,uCAAK,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,EAA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