@digabi/exam-engine-core 23.23.1-alpha.1 → 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.
- package/dist/__tests__/playwright/results/MultiLineAnswer.test.js +14 -7
- package/dist/__tests__/playwright/results/MultiLineAnswer.test.js.map +1 -1
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.d.ts +3 -3
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.d.ts.map +1 -1
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.js +6 -23
- package/dist/__tests__/playwright/stories/results/MultiLineAnswer.story.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/grading/largeImageDetector.js +4 -8
- package/dist/components/grading/largeImageDetector.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/package.json +2 -2
|
@@ -6,23 +6,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const experimental_ct_react_1 = require("@playwright/experimental-ct-react");
|
|
8
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
|
+
};
|
|
9
17
|
experimental_ct_react_1.test.describe('<MultiLineAnswer /> image opening', () => {
|
|
10
18
|
(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, {
|
|
12
|
-
const src = await component.locator('img').
|
|
13
|
-
(0, experimental_ct_react_1.expect)(src).not.toBeNull();
|
|
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);
|
|
14
21
|
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveAttribute('target', '_blank');
|
|
15
22
|
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image a')).toHaveAttribute('href', src);
|
|
16
23
|
});
|
|
17
24
|
(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, {
|
|
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
|
|
19
27
|
await waitForImageLoad(component.locator('img'));
|
|
20
28
|
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image')).toHaveCount(0);
|
|
21
29
|
});
|
|
22
|
-
(0, experimental_ct_react_1.test)('keeps
|
|
23
|
-
const component = await mount(react_1.default.createElement(MultiLineAnswer_story_1.
|
|
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 }));
|
|
24
32
|
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
33
|
await (0, experimental_ct_react_1.expect)(component.locator('.full-size-image mark')).toHaveCount(0);
|
|
27
34
|
await (0, experimental_ct_react_1.expect)(component.locator('mark')).toContainText('World');
|
|
28
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiLineAnswer.test.js","sourceRoot":"","sources":["../../../../__tests__/playwright/results/MultiLineAnswer.test.tsx"],"names":[],"mappings":";;;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pG,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Score } from '../../../../src';
|
|
2
3
|
import '../../../../src/css/main.less';
|
|
3
|
-
export declare const imageSrc: string;
|
|
4
4
|
export declare const MultiLineAnswerStory: React.FC<{
|
|
5
|
-
|
|
5
|
+
imageWidth: number;
|
|
6
|
+
score?: Score;
|
|
6
7
|
}>;
|
|
7
|
-
export declare const MultiLineAnswerDelayedScoreStory: React.FC;
|
|
8
8
|
//# sourceMappingURL=MultiLineAnswer.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiLineAnswer.story.d.ts","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/results/MultiLineAnswer.story.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|
|
@@ -33,36 +33,19 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.MultiLineAnswerStory = void 0;
|
|
37
37
|
const react_1 = __importStar(require("react"));
|
|
38
38
|
const react_i18next_1 = require("react-i18next");
|
|
39
39
|
const MultiLineAnswer_1 = require("../../../../src/components/results/MultiLineAnswer");
|
|
40
40
|
const i18n_1 = require("../../../../src/i18n");
|
|
41
41
|
require("../../../../src/css/main.less");
|
|
42
|
-
|
|
43
|
-
const answerWithImage = `Hello<img src="${
|
|
44
|
-
const MultiLineAnswerStory = ({
|
|
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
45
|
const i18n = (0, react_1.useMemo)(() => (0, i18n_1.initI18n)('fi-FI'), []);
|
|
46
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 }))));
|
|
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
49
|
};
|
|
50
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
51
|
//# sourceMappingURL=MultiLineAnswer.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiLineAnswer.story.js","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/results/MultiLineAnswer.story.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+
|
|
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"}
|