@digabi/exam-engine-core 22.1.6-alpha.3 → 22.1.6-alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/editor/ImageUploadButton.test.js +26 -1
- package/dist/__tests__/editor/ImageUploadButton.test.js.map +1 -1
- package/dist/__tests__/editor/spanLang.test.d.ts +2 -0
- package/dist/__tests__/editor/spanLang.test.d.ts.map +1 -0
- package/dist/__tests__/editor/spanLang.test.js +50 -0
- package/dist/__tests__/editor/spanLang.test.js.map +1 -0
- package/dist/__tests__/editor/spanWithLang.test.d.ts +2 -0
- package/dist/__tests__/editor/spanWithLang.test.d.ts.map +1 -0
- package/dist/__tests__/editor/spanWithLang.test.js +38 -0
- package/dist/__tests__/editor/spanWithLang.test.js.map +1 -0
- package/dist/__tests__/editor/sub.test.d.ts +2 -0
- package/dist/__tests__/editor/sub.test.d.ts.map +1 -0
- package/dist/__tests__/editor/sub.test.js +62 -0
- package/dist/__tests__/editor/sub.test.js.map +1 -0
- package/dist/__tests__/editor/subSup.test.d.ts +2 -0
- package/dist/__tests__/editor/subSup.test.d.ts.map +1 -0
- package/dist/__tests__/editor/subSup.test.js +50 -0
- package/dist/__tests__/editor/subSup.test.js.map +1 -0
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +12 -2
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
- package/dist/components/grading-instructions/editor/schemas/imageSchema.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/schemas/imageSchema.js +18 -4
- package/dist/components/grading-instructions/editor/schemas/imageSchema.js.map +1 -1
- package/dist/components/grading-instructions/editor/schemas/spanLang.d.ts +3 -0
- package/dist/components/grading-instructions/editor/schemas/spanLang.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/spanLang.js +23 -0
- package/dist/components/grading-instructions/editor/schemas/spanLang.js.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.d.ts +3 -0
- package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.js +19 -0
- package/dist/components/grading-instructions/editor/schemas/spanWithLangSchema.js.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js +1 -1
- package/dist/components/grading-instructions/editor/schemas/spanWithNowrapSchema.js.map +1 -1
- package/dist/components/grading-instructions/editor/schemas/subSup.d.ts +3 -0
- package/dist/components/grading-instructions/editor/schemas/subSup.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/subSup.js +23 -0
- package/dist/components/grading-instructions/editor/schemas/subSup.js.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/subSupSchema.d.ts +3 -0
- package/dist/components/grading-instructions/editor/schemas/subSupSchema.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/subSupSchema.js +23 -0
- package/dist/components/grading-instructions/editor/schemas/subSupSchema.js.map +1 -0
- package/dist/main-bundle.js +1 -1
- package/package.json +2 -2
@@ -39,7 +39,7 @@ describe('ImageUploadButton', () => {
|
|
39
39
|
class: htmlAttrs.class,
|
40
40
|
src: 'foo.bar'
|
41
41
|
};
|
42
|
-
it('e:image
|
42
|
+
it('e:image tag is rendered in and out with correct attributes and tags', async () => {
|
43
43
|
const container = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(`<div><p>hello</p><e:image data-editor-id="e-image" width=${htmlAttrs.width} height=${htmlAttrs.height} lang=${htmlAttrs.lang} class=${htmlAttrs.class} src=${xmlAttrs.src}></e:image></div>`, onContentChangeMock);
|
44
44
|
const image = container.getByRole('img');
|
45
45
|
for (const [key, value] of Object.entries(htmlAttrs)) {
|
@@ -64,6 +64,31 @@ describe('ImageUploadButton', () => {
|
|
64
64
|
expect(image).toHaveAttribute('src', `/${renderEditableGradingInstruction_1.mockedResolvedPath}/${renderEditableGradingInstruction_1.mockedPermanentUrl}`);
|
65
65
|
});
|
66
66
|
});
|
67
|
+
it('e:image-title tag is rendered in and out with correct attributes and tags', async () => {
|
68
|
+
const imageTitle = { default: 'Image title text', fi: 'title fi', sv: 'title sv' };
|
69
|
+
const container = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(`<div>
|
70
|
+
<p>hello</p>
|
71
|
+
<e:image data-editor-id="e-image" width=${htmlAttrs.width} height=${htmlAttrs.height} lang=${htmlAttrs.lang} class=${htmlAttrs.class} src=${xmlAttrs.src}>
|
72
|
+
<e:image-title data-editor-id="e-image-title">
|
73
|
+
${imageTitle.default}
|
74
|
+
<e:localization lang="fi-FI" exam-type="hearing-impaired" e-localization="1">${imageTitle.fi}</e:localization>
|
75
|
+
<e:localization lang="sv-FI" exam-type="hearing-impaired" e-localization="1">${imageTitle.sv}</e:localization>
|
76
|
+
</e:image-title>
|
77
|
+
</e:image>
|
78
|
+
</div>`, onContentChangeMock);
|
79
|
+
const figure = container.getByRole('figure');
|
80
|
+
for (const [key, value] of Object.entries(htmlAttrs)) {
|
81
|
+
expect((0, react_1.within)(figure).getByRole('img')).toHaveAttribute(key, value);
|
82
|
+
}
|
83
|
+
expect(figure.querySelector('figcaption')).toHaveTextContent(`${imageTitle.default} ${imageTitle.fi} ${imageTitle.sv}`);
|
84
|
+
expect(figure.querySelector('figcaption [lang="fi-FI"]')).toHaveTextContent(imageTitle.fi);
|
85
|
+
expect(figure.querySelector('figcaption [lang="sv-FI"]')).toHaveTextContent(imageTitle.sv);
|
86
|
+
await act(async () => {
|
87
|
+
(0, util_1.insertText)(await container.findByText('hello'), 'hello world');
|
88
|
+
});
|
89
|
+
expect(onContentChangeMock).toHaveBeenCalledTimes(1);
|
90
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(`<p>hello world</p><p><e:image lang="${xmlAttrs.lang}" class="${xmlAttrs.class}" src="${xmlAttrs.src}"><e:image-title>${imageTitle.default} <e:localization lang="fi-FI" exam-type="hearing-impaired">${imageTitle.fi}</e:localization> <e:localization lang="sv-FI" exam-type="hearing-impaired">${imageTitle.sv}</e:localization></e:image-title></e:image></p>`, '');
|
91
|
+
});
|
67
92
|
});
|
68
93
|
});
|
69
94
|
//# sourceMappingURL=ImageUploadButton.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ImageUploadButton.test.js","sourceRoot":"","sources":["../../../__tests__/editor/ImageUploadButton.test.tsx"],"names":[],"mappings":";;;;;AAAA,qCAAkC;AAClC,
|
1
|
+
{"version":3,"file":"ImageUploadButton.test.js","sourceRoot":"","sources":["../../../__tests__/editor/ImageUploadButton.test.tsx"],"names":[],"mappings":";;;;;AAAA,qCAAkC;AAClC,kDAAiF;AACjF,sDAAsD;AACtD,gGAIkD;AAClD,6EAAmD;AACnD,wCAA0C;AAC1C,uDAA6C;AAE7C,IAAI,CAAC,KAAK,CAAC,6BAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAEtE,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,mBAA8B,CAAA;IAClC,MAAM,aAAa,GAAG,iBAAiB,CAAA;IAEvC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,6BAAe,GAAE,CAAA;QACjB,MAAM,CAAC,GAAG,CAAC,eAAe,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,CAAA;QACzD,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9E,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,eAAO,G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9C,uCAAuC,QAAQ,CAAC,IAAI,YAAY,QAAQ,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAG,oBAAoB,UAAU,CAAC,OAAO,8DAA8D,UAAU,CAAC,EAAE,+EAA+E,UAAU,CAAC,EAAE,iDAAiD,EAClW,EAAE,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spanLang.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/spanLang.test.tsx"],"names":[],"mappings":""}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const react_1 = require("@testing-library/react");
|
4
|
+
const prosemirror_1 = require("../utils/prosemirror");
|
5
|
+
const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
|
6
|
+
const act = react_1.act;
|
7
|
+
describe('Editor - sub and sup', () => {
|
8
|
+
let cleanup;
|
9
|
+
let onContentChangeMock;
|
10
|
+
beforeEach(() => {
|
11
|
+
onContentChangeMock = jest.fn();
|
12
|
+
cleanup = (0, prosemirror_1.mockCreateRange)();
|
13
|
+
});
|
14
|
+
afterEach(() => {
|
15
|
+
if (cleanup) {
|
16
|
+
cleanup();
|
17
|
+
}
|
18
|
+
cleanup = null;
|
19
|
+
});
|
20
|
+
it('sub is rendered and returned as expected', async () => {
|
21
|
+
const inputData = '<p>bar</p><sub>foo</sub>';
|
22
|
+
const expectedDom = '<p>foo</p><p><sub>foo</sub></p>';
|
23
|
+
const expectedOutput = '<p>foo</p><p><sub>foo</sub></p>';
|
24
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
25
|
+
await act(async () => {
|
26
|
+
insertText(await result.findByText('bar'), 'foo');
|
27
|
+
});
|
28
|
+
const element = result.container.querySelector('.ProseMirror');
|
29
|
+
expect(element.innerHTML).toBe(expectedDom);
|
30
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
31
|
+
});
|
32
|
+
it('sup is rendered and returned as expected', async () => {
|
33
|
+
const inputData = '<p>bar</p><sup>foo</sup>';
|
34
|
+
const expectedDom = '<p>foo</p><p><sup>foo</sup></p>';
|
35
|
+
const expectedOutput = '<p>foo</p><p><sup>foo</sup></p>';
|
36
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
37
|
+
await act(async () => {
|
38
|
+
insertText(await result.findByText('bar'), 'foo');
|
39
|
+
});
|
40
|
+
const element = result.container.querySelector('.ProseMirror');
|
41
|
+
expect(element.innerHTML).toBe(expectedDom);
|
42
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
43
|
+
});
|
44
|
+
});
|
45
|
+
function insertText(element, text) {
|
46
|
+
react_1.fireEvent.input(element, {
|
47
|
+
target: { innerText: text, innerHTML: text }
|
48
|
+
});
|
49
|
+
}
|
50
|
+
//# sourceMappingURL=spanLang.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spanLang.test.js","sourceRoot":"","sources":["../../../__tests__/editor/spanLang.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QAC/B,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,C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AC,CAAA;QAC5C,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,UAAU,CAAC,OAAoB,EAAE,IAAY;IACpD,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spanWithLang.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/spanWithLang.test.tsx"],"names":[],"mappings":""}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const react_1 = require("@testing-library/react");
|
4
|
+
const prosemirror_1 = require("../utils/prosemirror");
|
5
|
+
const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
|
6
|
+
const act = react_1.act;
|
7
|
+
describe('Editor - span with lang attribute', () => {
|
8
|
+
let cleanup;
|
9
|
+
let onContentChangeMock;
|
10
|
+
beforeEach(() => {
|
11
|
+
onContentChangeMock = jest.fn();
|
12
|
+
cleanup = (0, prosemirror_1.mockCreateRange)();
|
13
|
+
});
|
14
|
+
afterEach(() => {
|
15
|
+
if (cleanup) {
|
16
|
+
cleanup();
|
17
|
+
}
|
18
|
+
cleanup = null;
|
19
|
+
});
|
20
|
+
it('span with lang attribute is rendered and returned as expected', async () => {
|
21
|
+
const inputData = '<p>bar</p><span lang="en-GB">foo</span>';
|
22
|
+
const expectedDom = '<p>foo</p><p><span lang="en-GB">foo</span></p>';
|
23
|
+
const expectedOutput = '<p>foo</p><p><span lang="en-GB">foo</span></p>';
|
24
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
25
|
+
await act(async () => {
|
26
|
+
insertText(await result.findByText('bar'), 'foo');
|
27
|
+
});
|
28
|
+
const element = result.container.querySelector('.ProseMirror');
|
29
|
+
expect(element.innerHTML).toBe(expectedDom);
|
30
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
31
|
+
});
|
32
|
+
});
|
33
|
+
function insertText(element, text) {
|
34
|
+
react_1.fireEvent.input(element, {
|
35
|
+
target: { innerText: text, innerHTML: text }
|
36
|
+
});
|
37
|
+
}
|
38
|
+
//# sourceMappingURL=spanWithLang.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spanWithLang.test.js","sourceRoot":"","sources":["../../../__tests__/editor/spanWithLang.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QAC/B,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;QAC7E,MAAM,SAAS,GAAG,yCAAyC,CAAA;QAC3D,MAAM,WAAW,GAAG,gDAAgD,CAAA;QACpE,MAAM,cAAc,GAAG,gDAAgD,CAAA;QACvE,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAC9D,MAAM,CAAC,OAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC5C,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,UAAU,CAAC,OAAoB,EAAE,IAAY;IACpD,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sub.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/sub.test.tsx"],"names":[],"mappings":""}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const react_1 = require("@testing-library/react");
|
4
|
+
const prosemirror_1 = require("../utils/prosemirror");
|
5
|
+
const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
|
6
|
+
const act = react_1.act;
|
7
|
+
describe('Editor - sub and sup', () => {
|
8
|
+
let cleanup;
|
9
|
+
let onContentChangeMock;
|
10
|
+
beforeEach(() => {
|
11
|
+
onContentChangeMock = jest.fn();
|
12
|
+
cleanup = (0, prosemirror_1.mockCreateRange)();
|
13
|
+
});
|
14
|
+
afterEach(() => {
|
15
|
+
if (cleanup) {
|
16
|
+
cleanup();
|
17
|
+
}
|
18
|
+
cleanup = null;
|
19
|
+
});
|
20
|
+
it('e-nowrap is rendered and returned as expected outside paragraph', async () => {
|
21
|
+
const inputData = '<p>bar</p><span class="e-nowrap">foo</span>';
|
22
|
+
const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
|
23
|
+
const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
|
24
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
25
|
+
await act(async () => {
|
26
|
+
insertText(await result.findByText('bar'), 'foo');
|
27
|
+
});
|
28
|
+
const element = result.container.querySelector('.ProseMirror');
|
29
|
+
expect(element.innerHTML).toBe(expectedDom);
|
30
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
31
|
+
});
|
32
|
+
it('e:formula is rendered as expected when wrapped inside e-nowrap', async () => {
|
33
|
+
const inputData = '<p>bar</p><span class="e-nowrap"><e:formula data-editor-id=e-formula>foo</e:formula></span>';
|
34
|
+
const expectedDom = '<p>foo</p><p><span class="e-nowrap"><img alt="foo" formula="true" src="/math.svg?latex=foo"><img class="ProseMirror-separator" alt=""></span><br class="ProseMirror-trailingBreak"></p>';
|
35
|
+
const expectedOutput = '<p>foo</p><p><span class="e-nowrap"><e:formula>foo</e:formula></span></p>';
|
36
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
37
|
+
await act(async () => {
|
38
|
+
insertText(await result.findByText('bar'), 'foo');
|
39
|
+
});
|
40
|
+
const element = result.container.querySelector('.ProseMirror');
|
41
|
+
expect(element.innerHTML).toBe(expectedDom);
|
42
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
43
|
+
});
|
44
|
+
it('e-nowrap is rendered as expected inside paragraph', async () => {
|
45
|
+
const inputData = '<p>bar</p><p><span class="e-nowrap">foo</span></p>';
|
46
|
+
const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
|
47
|
+
const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
|
48
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
49
|
+
await act(async () => {
|
50
|
+
insertText(await result.findByText('bar'), 'foo');
|
51
|
+
});
|
52
|
+
const element = result.container.querySelector('.ProseMirror');
|
53
|
+
expect(element.innerHTML).toBe(expectedDom);
|
54
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
55
|
+
});
|
56
|
+
});
|
57
|
+
function insertText(element, text) {
|
58
|
+
react_1.fireEvent.input(element, {
|
59
|
+
target: { innerText: text, innerHTML: text }
|
60
|
+
});
|
61
|
+
}
|
62
|
+
//# sourceMappingURL=sub.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sub.test.js","sourceRoot":"","sources":["../../../__tests__/editor/sub.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;QAC/B,OAAO,GAAG,IAAA,6BAAe,GAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QAC/E,MAAM,SAAS,GAAG,6CAA6C,CAAA;QAC/D,MAAM,WAAW,GAAG,oDAAoD,CAAA;QACxE,MAAM,cAAc,GAAG,oDAAoD,CAAA;QAC3E,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QAC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oD,CAAA;QAC3E,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvE,MAAM,GAAG,CAAC,KAAK,IAAI,EAAE;YACnB,UAAU,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAC9D,MAAM,CAAC,OAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC5C,MAAM,CAAC,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,UAAU,CAAC,OAAoB,EAAE,IAAY;IACpD,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"subSup.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/subSup.test.tsx"],"names":[],"mappings":""}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const react_1 = require("@testing-library/react");
|
4
|
+
const prosemirror_1 = require("../utils/prosemirror");
|
5
|
+
const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
|
6
|
+
const act = react_1.act;
|
7
|
+
describe('Editor - sub and sup', () => {
|
8
|
+
let cleanup;
|
9
|
+
let onContentChangeMock;
|
10
|
+
beforeEach(() => {
|
11
|
+
onContentChangeMock = jest.fn();
|
12
|
+
cleanup = (0, prosemirror_1.mockCreateRange)();
|
13
|
+
});
|
14
|
+
afterEach(() => {
|
15
|
+
if (cleanup) {
|
16
|
+
cleanup();
|
17
|
+
}
|
18
|
+
cleanup = null;
|
19
|
+
});
|
20
|
+
it('sub is rendered and returned as expected', async () => {
|
21
|
+
const inputData = '<p>bar</p><sub>foo</sub>';
|
22
|
+
const expectedDom = '<p>foo</p><p><sub>foo</sub></p>';
|
23
|
+
const expectedOutput = '<p>foo</p><p><sub>foo</sub></p>';
|
24
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
25
|
+
await act(async () => {
|
26
|
+
insertText(await result.findByText('bar'), 'foo');
|
27
|
+
});
|
28
|
+
const element = result.container.querySelector('.ProseMirror');
|
29
|
+
expect(element.innerHTML).toBe(expectedDom);
|
30
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
31
|
+
});
|
32
|
+
it('sup is rendered and returned as expected', async () => {
|
33
|
+
const inputData = '<p>bar</p><sup>foo</sup>';
|
34
|
+
const expectedDom = '<p>foo</p><p><sup>foo</sup></p>';
|
35
|
+
const expectedOutput = '<p>foo</p><p><sup>foo</sup></p>';
|
36
|
+
const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
|
37
|
+
await act(async () => {
|
38
|
+
insertText(await result.findByText('bar'), 'foo');
|
39
|
+
});
|
40
|
+
const element = result.container.querySelector('.ProseMirror');
|
41
|
+
expect(element.innerHTML).toBe(expectedDom);
|
42
|
+
expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
|
43
|
+
});
|
44
|
+
});
|
45
|
+
function insertText(element, text) {
|
46
|
+
react_1.fireEvent.input(element, {
|
47
|
+
target: { innerText: text, innerHTML: text }
|
48
|
+
});
|
49
|
+
}
|
50
|
+
//# sourceMappingURL=subSup.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"subSup.test.js","sourceRoot":"","sources":["../../../__tests__/editor/subSup.test.tsx"],"names":[],"mappings":";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