@digabi/exam-engine-core 23.1.0-alpha.0 → 23.1.1-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/playwright/DNDAnswerContainer.test.js +4 -4
- package/dist/__tests__/playwright/DNDAnswerContainer.test.js.map +1 -1
- package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.d.ts +1 -0
- package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.js +75 -15
- package/dist/__tests__/playwright/exam/DNDAnswerContainer.test.js.map +1 -1
- package/dist/__tests__/playwright/stories/exam/DNDAnswerContainer.story.d.ts +10 -0
- package/dist/__tests__/playwright/stories/exam/DNDAnswerContainer.story.d.ts.map +1 -0
- package/dist/__tests__/playwright/stories/exam/DNDAnswerContainer.story.js +21 -0
- package/dist/__tests__/playwright/stories/exam/DNDAnswerContainer.story.js.map +1 -0
- package/dist/__tests__/playwright/template/index.d.ts +0 -1
- package/dist/__tests__/playwright/template/index.d.ts.map +1 -1
- package/dist/__tests__/playwright/template/index.js +3 -2
- package/dist/__tests__/playwright/template/index.js.map +1 -1
- package/dist/__tests__/playwright/utils/ExamComponentWrapper.d.ts +9 -0
- package/dist/__tests__/playwright/utils/ExamComponentWrapper.d.ts.map +1 -0
- package/dist/__tests__/playwright/utils/ExamComponentWrapper.js +26 -0
- package/dist/__tests__/playwright/utils/ExamComponentWrapper.js.map +1 -0
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/exam/DNDAnswerOptionDraggable.js +1 -1
- package/dist/components/exam/DNDAnswerOptionDraggable.js.map +1 -1
- package/dist/components/exam/Exam.d.ts +1 -0
- package/dist/components/exam/Exam.d.ts.map +1 -1
- package/dist/components/exam/Exam.js +1 -1
- package/dist/components/exam/Exam.js.map +1 -1
- package/dist/components/results/AudioPlaceholder.d.ts +4 -0
- package/dist/components/results/AudioPlaceholder.d.ts.map +1 -0
- package/dist/components/results/AudioPlaceholder.js +25 -0
- package/dist/components/results/AudioPlaceholder.js.map +1 -0
- package/dist/components/results/Results.d.ts.map +1 -1
- package/dist/components/results/Results.js +2 -0
- package/dist/components/results/Results.js.map +1 -1
- package/dist/components/results/internal/QuestionScoresContainer.d.ts.map +1 -1
- package/dist/components/results/internal/QuestionScoresContainer.js +2 -3
- package/dist/components/results/internal/QuestionScoresContainer.js.map +1 -1
- package/dist/components/shared/DNDDroppable.d.ts.map +1 -1
- package/dist/components/shared/DNDDroppable.js +1 -1
- package/dist/components/shared/DNDDroppable.js.map +1 -1
- package/dist/components/shared/DNDTitleAndDroppable.d.ts.map +1 -1
- package/dist/components/shared/DNDTitleAndDroppable.js +3 -1
- package/dist/components/shared/DNDTitleAndDroppable.js.map +1 -1
- package/dist/components/shared/internal/RestrictedAudioPlayer.d.ts +1 -0
- package/dist/components/shared/internal/RestrictedAudioPlayer.d.ts.map +1 -1
- package/dist/components/shared/internal/RestrictedAudioPlayer.js +1 -1
- package/dist/components/shared/internal/RestrictedAudioPlayer.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/package.json +3 -3
@@ -55,10 +55,10 @@ async function assertContentMatches(answerContainer, content, mediaType) {
|
|
55
55
|
}
|
56
56
|
}
|
57
57
|
async function setupAnswerContext(component, answerMediaType) {
|
58
|
-
const answerContainer = component.
|
59
|
-
const answerOptionsLocator = component.
|
60
|
-
const firstAnswerLocator = component.
|
61
|
-
const secondAnswerLocator = component.
|
58
|
+
const answerContainer = component.getByTestId('dnd-droppable').first();
|
59
|
+
const answerOptionsLocator = component.getByTestId('dnd-droppable').last();
|
60
|
+
const firstAnswerLocator = component.getByTestId('dnd-answer-option').nth(0);
|
61
|
+
const secondAnswerLocator = component.getByTestId('dnd-answer-option').nth(1);
|
62
62
|
const firstAnswerContent = answerMediaType === 'text'
|
63
63
|
? await firstAnswerLocator.textContent()
|
64
64
|
: await firstAnswerLocator.locator('img').getAttribute('src');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DNDAnswerContainer.test.js","sourceRoot":"","sources":["../../../__tests__/playw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C,CAAA;IAEjE,MAAM,mBAAmB,GACvB,eAAe,KAAK,MAAM;QACxB,CAAC,CAAC,MAAM,mBAAmB,CAAC,WAAW,EAAE;QACzC,CAAC,CAAC,MAAM,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAElE,OAAO;QACL,eAAe;QACf,oBAAoB;QACpB,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB,EAAE,kBAA4B;QAChD,mBAAmB,EAAE,mBAA6B;KACnD,CAAA;AACH,CAAC"}
|
@@ -1,17 +1,77 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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 fs_1 = require("fs");
|
8
|
+
const path_1 = __importDefault(require("path"));
|
9
|
+
const experimental_ct_react_1 = require("@playwright/experimental-ct-react");
|
10
|
+
const exam_engine_exams_1 = require("@digabi/exam-engine-exams");
|
11
|
+
const exam_engine_mastering_1 = require("@digabi/exam-engine-mastering");
|
12
|
+
const DNDAnswerContainer_story_1 = require("../stories/exam/DNDAnswerContainer.story");
|
13
|
+
experimental_ct_react_1.test.describe('DNDAnswerContainer', () => {
|
14
|
+
let masteredExam;
|
15
|
+
experimental_ct_react_1.test.beforeAll(async () => {
|
16
|
+
masteredExam = await setupMasteredExam();
|
17
|
+
});
|
18
|
+
for (const answerMediaType of ['text', 'image']) {
|
19
|
+
(0, experimental_ct_react_1.test)(`Connect - basic drag and drop functionality for ${answerMediaType} answers`, async ({ mount }) => {
|
20
|
+
const component = await mount(react_1.default.createElement(DNDAnswerContainer_story_1.DNDAnswerContainerStory, { masteredExam: masteredExam, answerMediaType: answerMediaType }));
|
21
|
+
const { answerContainer, answerOptionsLocator, firstAnswerLocator, secondAnswerLocator, firstAnswerContent, secondAnswerContent } = await setupAnswerContext(component, answerMediaType);
|
22
|
+
await experimental_ct_react_1.test.step('Drag first answer to answer container', async () => {
|
23
|
+
const draggableLocator = firstAnswerLocator.locator('.drag-handle');
|
24
|
+
await draggableLocator.dragTo(answerContainer);
|
25
|
+
await assertContentMatches(answerContainer, firstAnswerContent, answerMediaType);
|
26
|
+
});
|
27
|
+
await experimental_ct_react_1.test.step('Replace first answer with second answer in answer container', async () => {
|
28
|
+
const draggableLocator = secondAnswerLocator.locator('.drag-handle');
|
29
|
+
await draggableLocator.dragTo(answerContainer);
|
30
|
+
await assertContentMatches(answerContainer, secondAnswerContent, answerMediaType);
|
31
|
+
});
|
32
|
+
await experimental_ct_react_1.test.step('Drag second answer back to options', async () => {
|
33
|
+
const draggableLocator = answerContainer.locator('.drag-handle');
|
34
|
+
await draggableLocator.dragTo(answerOptionsLocator);
|
35
|
+
await (0, experimental_ct_react_1.expect)(answerContainer).toContainText('Ei vastausta');
|
36
|
+
});
|
37
|
+
});
|
38
|
+
}
|
39
|
+
});
|
40
|
+
async function setupMasteredExam() {
|
41
|
+
const examPath = (0, exam_engine_exams_1.resolveExam)('SC/SC.xml');
|
42
|
+
const resolveAttachment = (filename) => path_1.default.resolve(path_1.default.dirname(examPath), 'attachments', filename);
|
43
|
+
const examXml = (0, fs_1.readFileSync)(examPath, 'utf-8');
|
44
|
+
const [masteredExam] = await (0, exam_engine_mastering_1.masterExam)(examXml, () => '', (0, exam_engine_mastering_1.getMediaMetadataFromLocalFile)(resolveAttachment), {
|
45
|
+
removeCorrectAnswers: true
|
46
|
+
});
|
47
|
+
return masteredExam;
|
48
|
+
}
|
49
|
+
async function assertContentMatches(answerContainer, content, mediaType) {
|
50
|
+
if (mediaType === 'text') {
|
51
|
+
await (0, experimental_ct_react_1.expect)(answerContainer).toContainText(content);
|
52
|
+
}
|
53
|
+
else if (mediaType === 'image') {
|
54
|
+
await (0, experimental_ct_react_1.expect)(answerContainer.locator('img')).toHaveAttribute('src', content);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
async function setupAnswerContext(component, answerMediaType) {
|
58
|
+
const answerContainer = component.getByTestId('dnd-droppable').first();
|
59
|
+
const answerOptionsLocator = component.getByTestId('dnd-droppable').last();
|
60
|
+
const firstAnswerLocator = component.getByTestId('dnd-answer-option').nth(0);
|
61
|
+
const secondAnswerLocator = component.getByTestId('dnd-answer-option').nth(1);
|
62
|
+
const firstAnswerContent = answerMediaType === 'text'
|
63
|
+
? await firstAnswerLocator.textContent()
|
64
|
+
: await firstAnswerLocator.locator('img').getAttribute('src');
|
65
|
+
const secondAnswerContent = answerMediaType === 'text'
|
66
|
+
? await secondAnswerLocator.textContent()
|
67
|
+
: await secondAnswerLocator.locator('img').getAttribute('src');
|
68
|
+
return {
|
69
|
+
answerContainer,
|
70
|
+
answerOptionsLocator,
|
71
|
+
firstAnswerLocator,
|
72
|
+
secondAnswerLocator,
|
73
|
+
firstAnswerContent: firstAnswerContent,
|
74
|
+
secondAnswerContent: secondAnswerContent
|
75
|
+
};
|
76
|
+
}
|
17
77
|
//# sourceMappingURL=DNDAnswerContainer.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DNDAnswerContainer.test.js","sourceRoot":"","sources":["../../../../__tests__/playwright/exam/DNDAnswerContainer.test.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"DNDAnswerContainer.test.js","sourceRoot":"","sources":["../../../../__tests__/playwright/exam/DNDAnswerContainer.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,2BAAiC;AACjC,gDAAuB;AACvB,6EAAgE;AAEhE,iEAAuD;AACvD,yEAA0G;AAC1G,uFAAkF;AAElF,4BAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE,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,CAAC,CAAA;IAC9E,CAAC;AACH,CAAC;AAED,KAAK,UAAU,kBAAkB,CAAC,SAAkB,EAAE,eAAiC;IACrF,MAAM,eAAe,GAAG,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,CAAA;IACtE,MAAM,oBAAoB,GAAG,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,CAAA;IAC1E,MAAM,kBAAkB,GAAG,SAAS,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC5E,MAAM,mBAAmB,GAAG,SAAS,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAE7E,MAAM,kBAAkB,GACtB,eAAe,KAAK,MAAM;QACxB,CAAC,CAAC,MAAM,kBAAkB,CAAC,WAAW,EAAE;QACxC,CAAC,CAAC,MAAM,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAEjE,MAAM,mBAAmB,GACvB,eAAe,KAAK,MAAM;QACxB,CAAC,CAAC,MAAM,mBAAmB,CAAC,WAAW,EAAE;QACzC,CAAC,CAAC,MAAM,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAElE,OAAO;QACL,eAAe;QACf,oBAAoB;QACpB,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB,EAAE,kBAA4B;QAChD,mBAAmB,EAAE,mBAA6B;KACnD,CAAA;AACH,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { MasteringResult } from '@digabi/exam-engine-mastering';
|
3
|
+
export type answerMediaType = 'text' | 'image';
|
4
|
+
interface DNDAnswerContainerStoryProps {
|
5
|
+
masteredExam: MasteringResult;
|
6
|
+
answerMediaType: answerMediaType;
|
7
|
+
}
|
8
|
+
export declare const DNDAnswerContainerStory: React.FC<DNDAnswerContainerStoryProps>;
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=DNDAnswerContainer.story.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DNDAnswerContainer.story.d.ts","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/exam/DNDAnswerContainer.story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAO/D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAA;AAE9C,UAAU,4BAA4B;IACpC,YAAY,EAAE,eAAe,CAAA;IAC7B,eAAe,EAAE,eAAe,CAAA;CACjC;AAED,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAc1E,CAAA"}
|
@@ -0,0 +1,21 @@
|
|
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.DNDAnswerContainerStory = void 0;
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
8
|
+
const react_1 = __importDefault(require("react"));
|
9
|
+
const Exam_1 = require("../../../../src/components/exam/Exam");
|
10
|
+
const DNDAnswerContainer_1 = require("../../../../src/components/exam/DNDAnswerContainer");
|
11
|
+
const ExamComponentWrapper_1 = require("../../utils/ExamComponentWrapper");
|
12
|
+
const parseExam_1 = __importDefault(require("../../../../src/parser/parseExam"));
|
13
|
+
const dom_utils_1 = require("../../../../src/dom-utils");
|
14
|
+
const DNDAnswerContainerStory = ({ masteredExam, answerMediaType }) => {
|
15
|
+
const doc = (0, parseExam_1.default)(masteredExam.xml, true);
|
16
|
+
const [textAnswers, imageAnswers] = (0, dom_utils_1.queryAll)(doc.documentElement, 'dnd-answer-container');
|
17
|
+
return (react_1.default.createElement(ExamComponentWrapper_1.ExamComponentWrapper, { doc: doc, resolveAttachment: (filename) => `/${masteredExam.examCode}/attachments/${filename}` },
|
18
|
+
react_1.default.createElement(DNDAnswerContainer_1.DNDAnswerContainer, { element: answerMediaType === 'text' ? textAnswers : imageAnswers, renderChildNodes: Exam_1.renderChildNodes })));
|
19
|
+
};
|
20
|
+
exports.DNDAnswerContainerStory = DNDAnswerContainerStory;
|
21
|
+
//# sourceMappingURL=DNDAnswerContainer.story.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DNDAnswerContainer.story.js","sourceRoot":"","sources":["../../../../../__tests__/playwright/stories/exam/DNDAnswerContainer.story.tsx"],"names":[],"mappings":";;;;;;AAAA,4DAA4D;AAC5D,kDAAyB;AAEzB,+DAAuE;AACvE,2FAAuF;AACvF,2EAAuE;AACvE,iFAAwD;AACxD,yDAAoD;AAS7C,MAAM,uBAAuB,GAA2C,CAAC,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,EAAE;IACnH,MAAM,GAAG,GAAG,IAAA,mBAAS,EAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC7C,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,GAAG,IAAA,oBAAQ,EAAC,GAAG,CAAC,eAAe,EAAE,sBAAsB,CAAC,CAAA;IACzF,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,uCAAkB,IACjB,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,EAChE,gBAAgB,EAAE,uBAAgB,GACd,CACD,CACxB,CAAA;AACH,CAAC,CAAA;AAdY,QAAA,uBAAuB,2BAcnC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../__tests__/playwright/template/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../__tests__/playwright/template/index.tsx"],"names":[],"mappings":""}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
2
|
+
// Note: this file needs to be here to be able to run the tests without errors.
|
3
|
+
// Import styles, initialize component theme here.
|
4
|
+
// import '../src/common.css';
|
4
5
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../__tests__/playwright/template/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../__tests__/playwright/template/index.tsx"],"names":[],"mappings":";AAAA,+EAA+E;AAE/E,kDAAkD;AAClD,8BAA8B"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { CommonExamProps } from '../../../src/components/exam/Exam';
|
3
|
+
import '../../../src/css/main.less';
|
4
|
+
export interface ExamComponentWrapperProps extends CommonExamProps {
|
5
|
+
doc: XMLDocument;
|
6
|
+
children: React.ReactElement;
|
7
|
+
}
|
8
|
+
export declare const ExamComponentWrapper: React.ComponentType<any>;
|
9
|
+
//# sourceMappingURL=ExamComponentWrapper.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ExamComponentWrapper.d.ts","sourceRoot":"","sources":["../../../../__tests__/playwright/utils/ExamComponentWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,4BAA4B,CAAA;AAEnC,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,GAAG,EAAE,WAAW,CAAA;IAChB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAA;CAC7B;AAeD,eAAO,MAAM,oBAAoB,0BAA2D,CAAA"}
|
@@ -0,0 +1,26 @@
|
|
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.ExamComponentWrapper = void 0;
|
7
|
+
const react_1 = __importDefault(require("react"));
|
8
|
+
const react_redux_1 = require("react-redux");
|
9
|
+
const react_i18next_1 = require("react-i18next");
|
10
|
+
const store_1 = require("../../../src/store");
|
11
|
+
const parseExamStructure_1 = require("../../../src/parser/parseExamStructure");
|
12
|
+
const useCached_1 = require("../../../src/useCached");
|
13
|
+
const examServerApi_1 = require("../../examServerApi");
|
14
|
+
const i18n_1 = require("../../../src/i18n");
|
15
|
+
const CommonExamContext_1 = require("../../../src/components/context/CommonExamContext");
|
16
|
+
const ExamContext_1 = require("../../../src/components/context/ExamContext");
|
17
|
+
require("../../../src/css/main.less");
|
18
|
+
const WrappedComponent = ({ doc, children }) => {
|
19
|
+
const i18n = (0, useCached_1.useCached)(() => (0, i18n_1.initI18n)('fi-FI'));
|
20
|
+
const store = (0, useCached_1.useCached)(() => (0, store_1.initializeExamStore)((0, parseExamStructure_1.parseExamStructure)(doc), 'allowed', [], [], examServerApi_1.examServerApi));
|
21
|
+
return (react_1.default.createElement(react_redux_1.Provider, { store: store },
|
22
|
+
react_1.default.createElement(react_i18next_1.I18nextProvider, { i18n: i18n },
|
23
|
+
react_1.default.createElement("div", { className: "e-exam" }, children))));
|
24
|
+
};
|
25
|
+
exports.ExamComponentWrapper = (0, ExamContext_1.withExamContext)((0, CommonExamContext_1.withCommonExamContext)(WrappedComponent));
|
26
|
+
//# sourceMappingURL=ExamComponentWrapper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ExamComponentWrapper.js","sourceRoot":"","sources":["../../../../__tests__/playwright/utils/ExamComponentWrapper.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,6CAAsC;AACtC,iDAA+C;AAC/C,8CAAwD;AACxD,+EAA2E;AAC3E,sDAAkD;AAClD,uDAAmD;AACnD,4CAA4C;AAC5C,yFAAyF;AACzF,6EAA6E;AAE7E,sCAAmC;AAOnC,MAAM,gBAAgB,GAAwC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClF,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,GAAG,EAAE,CAAC,IAAA,eAAQ,EAAC,OAAO,CAAC,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAG,IAAA,qBAAS,EAAC,GAAG,EAAE,CAAC,IAAA,2BAAmB,EAAC,IAAA,uCAAkB,EAAC,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,6BAAa,CAAC,CAAC,CAAA;IAE7G,OAAO,CACL,8BAAC,sBAAQ,IAAC,KAAK,EAAE,KAAK;QACpB,8BAAC,+BAAe,IAAC,IAAI,EAAE,IAAI;YACzB,uCAAK,SAAS,EAAC,QAAQ,IAAE,QAAQ,CAAO,CACxB,CACT,CACZ,CAAA;AACH,CAAC,CAAA;AAEY,QAAA,oBAAoB,GAAG,IAAA,6BAAe,EAAC,IAAA,yCAAqB,EAAC,gBAAgB,CAAC,CAAC,CAAA"}
|