@pie-lib/math-input-mathlive 1.0.8 → 1.0.9-next.6618

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 (37) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +1 -1
  3. package/lib/mathlive-instance.js +0 -13
  4. package/lib/mathlive-instance.js.map +1 -1
  5. package/lib/mf/input.js +5 -18
  6. package/lib/mf/input.js.map +1 -1
  7. package/lib/mf/static.js +4 -17
  8. package/lib/mf/static.js.map +1 -1
  9. package/package.json +4 -3
  10. package/src/__tests__/keypad-label.test.jsx +13 -5
  11. package/src/mathlive-instance.js +0 -12
  12. package/src/mf/input.jsx +5 -19
  13. package/src/mf/static.jsx +4 -20
  14. package/lib/__tests__/composites.test.js +0 -255
  15. package/lib/__tests__/composites.test.js.map +0 -1
  16. package/lib/__tests__/drop-in-compat.test.js +0 -133
  17. package/lib/__tests__/drop-in-compat.test.js.map +0 -1
  18. package/lib/__tests__/index.test.js +0 -118
  19. package/lib/__tests__/index.test.js.map +0 -1
  20. package/lib/__tests__/input-imperative.test.js +0 -155
  21. package/lib/__tests__/input-imperative.test.js.map +0 -1
  22. package/lib/__tests__/keypad-label.test.js +0 -44
  23. package/lib/__tests__/keypad-label.test.js.map +0 -1
  24. package/lib/__tests__/keypad-render.test.js +0 -206
  25. package/lib/__tests__/keypad-render.test.js.map +0 -1
  26. package/lib/__tests__/latex-bridge.test.js +0 -251
  27. package/lib/__tests__/latex-bridge.test.js.map +0 -1
  28. package/lib/__tests__/mathlive-instance.test.js +0 -188
  29. package/lib/__tests__/mathlive-instance.test.js.map +0 -1
  30. package/lib/__tests__/mount-race.test.js +0 -194
  31. package/lib/__tests__/mount-race.test.js.map +0 -1
  32. package/lib/__tests__/static-prompts.test.js +0 -282
  33. package/lib/__tests__/static-prompts.test.js.map +0 -1
  34. package/src/__tests__/composites.test.jsx +0 -220
  35. package/src/__tests__/keypad-render.test.jsx +0 -123
  36. package/src/__tests__/mount-race.test.jsx +0 -129
  37. package/src/__tests__/static-prompts.test.jsx +0 -251
@@ -1,251 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
5
- var _latexBridge = require("../latex-bridge");
6
- describe('latex-bridge', function () {
7
- describe('toMathLive', function () {
8
- it('passes plain latex through', function () {
9
- expect((0, _latexBridge.toMathLive)('\\frac{1}{2}')).toEqual('\\frac{1}{2}');
10
- });
11
- it('handles empty/nullish', function () {
12
- expect((0, _latexBridge.toMathLive)('')).toEqual('');
13
- expect((0, _latexBridge.toMathLive)(undefined)).toEqual('');
14
- expect((0, _latexBridge.toMathLive)(null)).toEqual('');
15
- });
16
- it('converts a newLine embed to a multiline environment', function () {
17
- expect((0, _latexBridge.toMathLive)("a".concat(_latexBridge.NEWLINE_EMBED, "b"))).toEqual('\\displaylines{a \\\\ b}');
18
- });
19
- it('converts multiple newLine embeds', function () {
20
- expect((0, _latexBridge.toMathLive)("a".concat(_latexBridge.NEWLINE_EMBED, "b").concat(_latexBridge.NEWLINE_EMBED, "c"))).toEqual('\\displaylines{a \\\\ b \\\\ c}');
21
- });
22
- it('converts MathQuill answer blocks to placeholders', function () {
23
- expect((0, _latexBridge.toMathLive)('x=\\MathQuillMathField[r1]{}')).toEqual('x=\\placeholder[r1]{}');
24
- });
25
- it('preserves answer block content', function () {
26
- expect((0, _latexBridge.toMathLive)('\\MathQuillMathField[r2]{7}')).toEqual('\\placeholder[r2]{7}');
27
- });
28
- it('defaults an unnamed answer block id', function () {
29
- expect((0, _latexBridge.toMathLive)('\\MathQuillMathField[]{}')).toEqual("\\placeholder[".concat(_latexBridge.DEFAULT_FIELD_ID, "]{}"));
30
- });
31
- it('handles answer blocks and newlines together', function () {
32
- expect((0, _latexBridge.toMathLive)("\\MathQuillMathField[r1]{}".concat(_latexBridge.NEWLINE_EMBED, "x"))).toEqual('\\displaylines{\\placeholder[r1]{} \\\\ x}');
33
- });
34
- });
35
- describe('fromMathLive', function () {
36
- it('passes plain latex through', function () {
37
- expect((0, _latexBridge.fromMathLive)('\\frac{1}{2}')).toEqual('\\frac{1}{2}');
38
- });
39
- it('unwraps displaylines back to newLine embeds', function () {
40
- expect((0, _latexBridge.fromMathLive)('\\displaylines{a \\\\ b}')).toEqual("a".concat(_latexBridge.NEWLINE_EMBED, "b"));
41
- });
42
- it('converts placeholders back to MathQuill answer blocks', function () {
43
- expect((0, _latexBridge.fromMathLive)('x=\\placeholder[r1]{}')).toEqual('x=\\MathQuillMathField[r1]{}');
44
- });
45
- it('round-trips a newline document', function () {
46
- var stored = "a".concat(_latexBridge.NEWLINE_EMBED, "b").concat(_latexBridge.NEWLINE_EMBED, "c");
47
- expect((0, _latexBridge.fromMathLive)((0, _latexBridge.toMathLive)(stored))).toEqual(stored);
48
- });
49
- it('round-trips an answer-block document', function () {
50
- var stored = 'x=\\MathQuillMathField[r1]{}+\\MathQuillMathField[r2]{3}';
51
- expect((0, _latexBridge.fromMathLive)((0, _latexBridge.toMathLive)(stored))).toEqual(stored);
52
- });
53
-
54
- // MathLive serialises empty slots as \placeholder{}, which MathJax (used by
55
- // @pie-lib/math-rendering for prompts/previews) renders as red error text.
56
- it('strips unnamed placeholders that MathLive adds', function () {
57
- expect((0, _latexBridge.fromMathLive)('\\longdiv{\\placeholder{}}')).toEqual('\\longdiv{}');
58
- expect((0, _latexBridge.fromMathLive)('\\frac{\\placeholder{}}{\\placeholder{}}')).toEqual('\\frac{}{}');
59
- });
60
- it('keeps content inside an unnamed placeholder', function () {
61
- expect((0, _latexBridge.fromMathLive)('\\sqrt{\\placeholder{7}}')).toEqual('\\sqrt{7}');
62
- });
63
- it('handles a bare \\placeholder with no argument', function () {
64
- expect((0, _latexBridge.fromMathLive)('\\longdiv{\\placeholder}')).toEqual('\\longdiv{}');
65
- });
66
- it('never leaks the token \\placeholder', function () {
67
- ['\\longdiv{\\placeholder{}}', '\\frac{\\placeholder{}}{x}', '\\placeholder{}'].forEach(function (l) {
68
- expect((0, _latexBridge.fromMathLive)(l)).not.toContain('\\placeholder');
69
- });
70
- });
71
- it('still maps NAMED placeholders to answer blocks', function () {
72
- // named ones are answer blocks and must survive
73
- expect((0, _latexBridge.fromMathLive)('\\placeholder[r1]{}')).toEqual('\\MathQuillMathField[r1]{}');
74
- });
75
- it('round-trips answer blocks combined with newlines', function () {
76
- var stored = "\\MathQuillMathField[r1]{}".concat(_latexBridge.NEWLINE_EMBED, "y");
77
- expect((0, _latexBridge.fromMathLive)((0, _latexBridge.toMathLive)(stored))).toEqual(stored);
78
- });
79
- });
80
-
81
- // A MathLive macro serialises from the arguments it was created with, so text
82
- // typed inside its expansion never comes back out of getValue('latex').
83
- // Argument-taking pie commands must therefore become native constructs before
84
- // they reach a mathfield.
85
- describe('toNativeCommands', function () {
86
- it('expands \\longdiv to native \\enclose', function () {
87
- expect((0, _latexBridge.toNativeCommands)('\\longdiv{1234}')).toEqual('\\enclose{longdiv}{1234}');
88
- expect((0, _latexBridge.toNativeCommands)('\\longdiv{}')).toEqual('\\enclose{longdiv}{}');
89
- });
90
- it('expands \\overarc to native \\overparen', function () {
91
- expect((0, _latexBridge.toNativeCommands)('\\overarc{AB}')).toEqual('\\overparen{AB}');
92
- });
93
- it('expands \\abs to native \\left|..\\right|', function () {
94
- expect((0, _latexBridge.toNativeCommands)('\\abs{x}')).toEqual('\\left|x\\right|');
95
- expect((0, _latexBridge.toNativeCommands)('\\abs{}')).toEqual('\\left|\\right|');
96
- });
97
- it('handles nested braces inside \\abs', function () {
98
- expect((0, _latexBridge.toNativeCommands)('\\abs{\\frac{1}{2}}')).toEqual('\\left|\\frac{1}{2}\\right|');
99
- });
100
- it('handles several occurrences', function () {
101
- expect((0, _latexBridge.toNativeCommands)('\\abs{a}+\\abs{b}')).toEqual('\\left|a\\right|+\\left|b\\right|');
102
- expect((0, _latexBridge.toNativeCommands)('\\longdiv{1}\\longdiv{2}')).toEqual('\\enclose{longdiv}{1}\\enclose{longdiv}{2}');
103
- });
104
- it('leaves other latex untouched', function () {
105
- ['\\frac{1}{2}', '\\pi', '\\sqrt{x}', '\\overline{AB}'].forEach(function (l) {
106
- expect((0, _latexBridge.toNativeCommands)(l)).toEqual(l);
107
- });
108
- });
109
- it('handles nullish input', function () {
110
- expect((0, _latexBridge.toNativeCommands)(undefined)).toEqual('');
111
- expect((0, _latexBridge.toNativeCommands)('')).toEqual('');
112
- });
113
- it('is applied by toMathLive', function () {
114
- expect((0, _latexBridge.toMathLive)('\\longdiv{5}')).toEqual('\\enclose{longdiv}{5}');
115
- });
116
- it('does not leave a pie macro in what reaches the field', function () {
117
- ['\\longdiv{7}', '\\abs{7}', '\\overarc{7}'].forEach(function (l) {
118
- var out = (0, _latexBridge.toMathLive)(l);
119
- expect(out).not.toMatch(/\\longdiv|\\abs|\\overarc/);
120
- });
121
- });
122
- });
123
- describe('fieldIds', function () {
124
- it('returns ids in document order', function () {
125
- expect((0, _latexBridge.fieldIds)('\\MathQuillMathField[r1]{}+\\MathQuillMathField[r2]{}')).toEqual(['r1', 'r2']);
126
- });
127
- it('returns [] when there are none', function () {
128
- expect((0, _latexBridge.fieldIds)('x+y')).toEqual([]);
129
- expect((0, _latexBridge.fieldIds)(undefined)).toEqual([]);
130
- });
131
- it('is repeatable (regex lastIndex is reset)', function () {
132
- var latex = '\\MathQuillMathField[r1]{}';
133
- expect((0, _latexBridge.fieldIds)(latex)).toEqual(['r1']);
134
- expect((0, _latexBridge.fieldIds)(latex)).toEqual(['r1']);
135
- });
136
- });
137
- describe('keyToAction', function () {
138
- it('prefers latex when there is no command', function () {
139
- expect((0, _latexBridge.keyToAction)({
140
- latex: '\\pi',
141
- write: 'p'
142
- })).toEqual({
143
- type: 'insert',
144
- value: '\\pi'
145
- });
146
- });
147
- it('uses write', function () {
148
- expect((0, _latexBridge.keyToAction)({
149
- write: 'x'
150
- })).toEqual({
151
- type: 'insert',
152
- value: 'x'
153
- });
154
- });
155
- it('expands commands that take arguments into placeholders', function () {
156
- expect((0, _latexBridge.keyToAction)({
157
- command: '\\frac'
158
- })).toEqual({
159
- type: 'insert',
160
- value: '\\frac{#?}{#?}'
161
- });
162
- expect((0, _latexBridge.keyToAction)({
163
- command: '\\sqrt'
164
- })).toEqual({
165
- type: 'insert',
166
- value: '\\sqrt{#?}'
167
- });
168
- expect((0, _latexBridge.keyToAction)({
169
- command: '^'
170
- })).toEqual({
171
- type: 'insert',
172
- value: '^{#?}'
173
- });
174
- });
175
- it('passes argument-less commands through', function () {
176
- expect((0, _latexBridge.keyToAction)({
177
- command: '\\pi'
178
- })).toEqual({
179
- type: 'insert',
180
- value: '\\pi'
181
- });
182
- });
183
- it('concatenates array commands (MathQuill cmd() applied them in sequence)', function () {
184
- // Measured Angle
185
- expect((0, _latexBridge.keyToAction)({
186
- command: ['m', '\\angle']
187
- })).toEqual({
188
- type: 'insert',
189
- value: 'm\\angle'
190
- });
191
- // log base n - the `_` part must still expand to a placeholder
192
- expect((0, _latexBridge.keyToAction)({
193
- command: ['\\log', '_']
194
- })).toEqual({
195
- type: 'insert',
196
- value: '\\log_{#?}'
197
- });
198
- });
199
- it('always returns a string value for insert actions', function () {
200
- [{
201
- command: ['m', '\\angle']
202
- }, {
203
- command: '\\frac'
204
- }, {
205
- write: 'x'
206
- }, {
207
- latex: '\\pi'
208
- }].forEach(function (k) {
209
- expect((0, _typeof2["default"])((0, _latexBridge.keyToAction)(k).value)).toBe('string');
210
- });
211
- });
212
- it('maps keystrokes to MathLive selectors', function () {
213
- expect((0, _latexBridge.keyToAction)({
214
- keystroke: 'Left'
215
- })).toEqual({
216
- type: 'command',
217
- value: 'moveToPreviousChar'
218
- });
219
- expect((0, _latexBridge.keyToAction)({
220
- keystroke: 'Right'
221
- })).toEqual({
222
- type: 'command',
223
- value: 'moveToNextChar'
224
- });
225
- expect((0, _latexBridge.keyToAction)({
226
- keystroke: 'Backspace'
227
- })).toEqual({
228
- type: 'command',
229
- value: 'deleteBackward'
230
- });
231
- });
232
- it('returns undefined for unknown/empty input', function () {
233
- expect((0, _latexBridge.keyToAction)(undefined)).toBeUndefined();
234
- expect((0, _latexBridge.keyToAction)({})).toBeUndefined();
235
- expect((0, _latexBridge.keyToAction)({
236
- keystroke: 'Nope'
237
- })).toBeUndefined();
238
- });
239
- it('latex wins over command only when command is absent', function () {
240
- // a key with both should use the command path (matches MathInput.keypadPress)
241
- expect((0, _latexBridge.keyToAction)({
242
- latex: '\\frac{}{}',
243
- command: '\\frac'
244
- })).toEqual({
245
- type: 'insert',
246
- value: '\\frac{#?}{#?}'
247
- });
248
- });
249
- });
250
- });
251
- //# sourceMappingURL=latex-bridge.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latex-bridge.test.js","names":["_latexBridge","require","describe","it","expect","toMathLive","toEqual","undefined","concat","NEWLINE_EMBED","DEFAULT_FIELD_ID","fromMathLive","stored","forEach","l","not","toContain","toNativeCommands","out","toMatch","fieldIds","latex","keyToAction","write","type","value","command","k","_typeof2","toBe","keystroke","toBeUndefined"],"sources":["../../src/__tests__/latex-bridge.test.js"],"sourcesContent":["import {\n toMathLive,\n fromMathLive,\n fieldIds,\n keyToAction,\n toNativeCommands,\n NEWLINE_EMBED,\n DEFAULT_FIELD_ID,\n} from '../latex-bridge';\n\ndescribe('latex-bridge', () => {\n describe('toMathLive', () => {\n it('passes plain latex through', () => {\n expect(toMathLive('\\\\frac{1}{2}')).toEqual('\\\\frac{1}{2}');\n });\n\n it('handles empty/nullish', () => {\n expect(toMathLive('')).toEqual('');\n expect(toMathLive(undefined)).toEqual('');\n expect(toMathLive(null)).toEqual('');\n });\n\n it('converts a newLine embed to a multiline environment', () => {\n expect(toMathLive(`a${NEWLINE_EMBED}b`)).toEqual('\\\\displaylines{a \\\\\\\\ b}');\n });\n\n it('converts multiple newLine embeds', () => {\n expect(toMathLive(`a${NEWLINE_EMBED}b${NEWLINE_EMBED}c`)).toEqual('\\\\displaylines{a \\\\\\\\ b \\\\\\\\ c}');\n });\n\n it('converts MathQuill answer blocks to placeholders', () => {\n expect(toMathLive('x=\\\\MathQuillMathField[r1]{}')).toEqual('x=\\\\placeholder[r1]{}');\n });\n\n it('preserves answer block content', () => {\n expect(toMathLive('\\\\MathQuillMathField[r2]{7}')).toEqual('\\\\placeholder[r2]{7}');\n });\n\n it('defaults an unnamed answer block id', () => {\n expect(toMathLive('\\\\MathQuillMathField[]{}')).toEqual(`\\\\placeholder[${DEFAULT_FIELD_ID}]{}`);\n });\n\n it('handles answer blocks and newlines together', () => {\n expect(toMathLive(`\\\\MathQuillMathField[r1]{}${NEWLINE_EMBED}x`)).toEqual(\n '\\\\displaylines{\\\\placeholder[r1]{} \\\\\\\\ x}',\n );\n });\n });\n\n describe('fromMathLive', () => {\n it('passes plain latex through', () => {\n expect(fromMathLive('\\\\frac{1}{2}')).toEqual('\\\\frac{1}{2}');\n });\n\n it('unwraps displaylines back to newLine embeds', () => {\n expect(fromMathLive('\\\\displaylines{a \\\\\\\\ b}')).toEqual(`a${NEWLINE_EMBED}b`);\n });\n\n it('converts placeholders back to MathQuill answer blocks', () => {\n expect(fromMathLive('x=\\\\placeholder[r1]{}')).toEqual('x=\\\\MathQuillMathField[r1]{}');\n });\n\n it('round-trips a newline document', () => {\n const stored = `a${NEWLINE_EMBED}b${NEWLINE_EMBED}c`;\n\n expect(fromMathLive(toMathLive(stored))).toEqual(stored);\n });\n\n it('round-trips an answer-block document', () => {\n const stored = 'x=\\\\MathQuillMathField[r1]{}+\\\\MathQuillMathField[r2]{3}';\n\n expect(fromMathLive(toMathLive(stored))).toEqual(stored);\n });\n\n // MathLive serialises empty slots as \\placeholder{}, which MathJax (used by\n // @pie-lib/math-rendering for prompts/previews) renders as red error text.\n it('strips unnamed placeholders that MathLive adds', () => {\n expect(fromMathLive('\\\\longdiv{\\\\placeholder{}}')).toEqual('\\\\longdiv{}');\n expect(fromMathLive('\\\\frac{\\\\placeholder{}}{\\\\placeholder{}}')).toEqual('\\\\frac{}{}');\n });\n\n it('keeps content inside an unnamed placeholder', () => {\n expect(fromMathLive('\\\\sqrt{\\\\placeholder{7}}')).toEqual('\\\\sqrt{7}');\n });\n\n it('handles a bare \\\\placeholder with no argument', () => {\n expect(fromMathLive('\\\\longdiv{\\\\placeholder}')).toEqual('\\\\longdiv{}');\n });\n\n it('never leaks the token \\\\placeholder', () => {\n ['\\\\longdiv{\\\\placeholder{}}', '\\\\frac{\\\\placeholder{}}{x}', '\\\\placeholder{}'].forEach((l) => {\n expect(fromMathLive(l)).not.toContain('\\\\placeholder');\n });\n });\n\n it('still maps NAMED placeholders to answer blocks', () => {\n // named ones are answer blocks and must survive\n expect(fromMathLive('\\\\placeholder[r1]{}')).toEqual('\\\\MathQuillMathField[r1]{}');\n });\n\n it('round-trips answer blocks combined with newlines', () => {\n const stored = `\\\\MathQuillMathField[r1]{}${NEWLINE_EMBED}y`;\n\n expect(fromMathLive(toMathLive(stored))).toEqual(stored);\n });\n });\n\n // A MathLive macro serialises from the arguments it was created with, so text\n // typed inside its expansion never comes back out of getValue('latex').\n // Argument-taking pie commands must therefore become native constructs before\n // they reach a mathfield.\n describe('toNativeCommands', () => {\n it('expands \\\\longdiv to native \\\\enclose', () => {\n expect(toNativeCommands('\\\\longdiv{1234}')).toEqual('\\\\enclose{longdiv}{1234}');\n expect(toNativeCommands('\\\\longdiv{}')).toEqual('\\\\enclose{longdiv}{}');\n });\n\n it('expands \\\\overarc to native \\\\overparen', () => {\n expect(toNativeCommands('\\\\overarc{AB}')).toEqual('\\\\overparen{AB}');\n });\n\n it('expands \\\\abs to native \\\\left|..\\\\right|', () => {\n expect(toNativeCommands('\\\\abs{x}')).toEqual('\\\\left|x\\\\right|');\n expect(toNativeCommands('\\\\abs{}')).toEqual('\\\\left|\\\\right|');\n });\n\n it('handles nested braces inside \\\\abs', () => {\n expect(toNativeCommands('\\\\abs{\\\\frac{1}{2}}')).toEqual('\\\\left|\\\\frac{1}{2}\\\\right|');\n });\n\n it('handles several occurrences', () => {\n expect(toNativeCommands('\\\\abs{a}+\\\\abs{b}')).toEqual('\\\\left|a\\\\right|+\\\\left|b\\\\right|');\n expect(toNativeCommands('\\\\longdiv{1}\\\\longdiv{2}')).toEqual('\\\\enclose{longdiv}{1}\\\\enclose{longdiv}{2}');\n });\n\n it('leaves other latex untouched', () => {\n ['\\\\frac{1}{2}', '\\\\pi', '\\\\sqrt{x}', '\\\\overline{AB}'].forEach((l) => {\n expect(toNativeCommands(l)).toEqual(l);\n });\n });\n\n it('handles nullish input', () => {\n expect(toNativeCommands(undefined)).toEqual('');\n expect(toNativeCommands('')).toEqual('');\n });\n\n it('is applied by toMathLive', () => {\n expect(toMathLive('\\\\longdiv{5}')).toEqual('\\\\enclose{longdiv}{5}');\n });\n\n it('does not leave a pie macro in what reaches the field', () => {\n ['\\\\longdiv{7}', '\\\\abs{7}', '\\\\overarc{7}'].forEach((l) => {\n const out = toMathLive(l);\n\n expect(out).not.toMatch(/\\\\longdiv|\\\\abs|\\\\overarc/);\n });\n });\n });\n\n describe('fieldIds', () => {\n it('returns ids in document order', () => {\n expect(fieldIds('\\\\MathQuillMathField[r1]{}+\\\\MathQuillMathField[r2]{}')).toEqual(['r1', 'r2']);\n });\n\n it('returns [] when there are none', () => {\n expect(fieldIds('x+y')).toEqual([]);\n expect(fieldIds(undefined)).toEqual([]);\n });\n\n it('is repeatable (regex lastIndex is reset)', () => {\n const latex = '\\\\MathQuillMathField[r1]{}';\n\n expect(fieldIds(latex)).toEqual(['r1']);\n expect(fieldIds(latex)).toEqual(['r1']);\n });\n });\n\n describe('keyToAction', () => {\n it('prefers latex when there is no command', () => {\n expect(keyToAction({ latex: '\\\\pi', write: 'p' })).toEqual({ type: 'insert', value: '\\\\pi' });\n });\n\n it('uses write', () => {\n expect(keyToAction({ write: 'x' })).toEqual({ type: 'insert', value: 'x' });\n });\n\n it('expands commands that take arguments into placeholders', () => {\n expect(keyToAction({ command: '\\\\frac' })).toEqual({ type: 'insert', value: '\\\\frac{#?}{#?}' });\n expect(keyToAction({ command: '\\\\sqrt' })).toEqual({ type: 'insert', value: '\\\\sqrt{#?}' });\n expect(keyToAction({ command: '^' })).toEqual({ type: 'insert', value: '^{#?}' });\n });\n\n it('passes argument-less commands through', () => {\n expect(keyToAction({ command: '\\\\pi' })).toEqual({ type: 'insert', value: '\\\\pi' });\n });\n\n it('concatenates array commands (MathQuill cmd() applied them in sequence)', () => {\n // Measured Angle\n expect(keyToAction({ command: ['m', '\\\\angle'] })).toEqual({ type: 'insert', value: 'm\\\\angle' });\n // log base n - the `_` part must still expand to a placeholder\n expect(keyToAction({ command: ['\\\\log', '_'] })).toEqual({ type: 'insert', value: '\\\\log_{#?}' });\n });\n\n it('always returns a string value for insert actions', () => {\n [{ command: ['m', '\\\\angle'] }, { command: '\\\\frac' }, { write: 'x' }, { latex: '\\\\pi' }].forEach((k) => {\n expect(typeof keyToAction(k).value).toBe('string');\n });\n });\n\n it('maps keystrokes to MathLive selectors', () => {\n expect(keyToAction({ keystroke: 'Left' })).toEqual({ type: 'command', value: 'moveToPreviousChar' });\n expect(keyToAction({ keystroke: 'Right' })).toEqual({ type: 'command', value: 'moveToNextChar' });\n expect(keyToAction({ keystroke: 'Backspace' })).toEqual({ type: 'command', value: 'deleteBackward' });\n });\n\n it('returns undefined for unknown/empty input', () => {\n expect(keyToAction(undefined)).toBeUndefined();\n expect(keyToAction({})).toBeUndefined();\n expect(keyToAction({ keystroke: 'Nope' })).toBeUndefined();\n });\n\n it('latex wins over command only when command is absent', () => {\n // a key with both should use the command path (matches MathInput.keypadPress)\n expect(keyToAction({ latex: '\\\\frac{}{}', command: '\\\\frac' })).toEqual({\n type: 'insert',\n value: '\\\\frac{#?}{#?}',\n });\n });\n });\n});\n"],"mappings":";;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUAC,QAAQ,CAAC,cAAc,EAAE,YAAM;EAC7BA,QAAQ,CAAC,YAAY,EAAE,YAAM;IAC3BC,EAAE,CAAC,4BAA4B,EAAE,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ACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,188 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
5
- describe('mathlive-instance', function () {
6
- var instance;
7
- beforeEach(function () {
8
- jest.resetModules();
9
- // eslint-disable-next-line global-require
10
- instance = require('../mathlive-instance');
11
- instance.__resetEmbeds();
12
- });
13
- describe('registerEmbed', function () {
14
- it('registers a known embed and exposes it as a macro', function () {
15
- instance.registerEmbed('answerBlock', function () {
16
- return {
17
- htmlString: '<div class="answerBlock"></div>',
18
- latex: function latex() {
19
- return '\\embed{answerBlock}[]';
20
- }
21
- };
22
- });
23
- expect(instance.registeredEmbeds()).toEqual(['answerBlock']);
24
- // The macro tags output with data-embed so CSS can target it, replacing
25
- // MathQuill's htmlString hook.
26
- expect(instance.getMacros().answerBlock).toEqual('\\htmlData{embed=answerBlock}{\\placeholder{}}');
27
- });
28
- it('registers newLine as a harmless macro (it is handled by latex-bridge)', function () {
29
- instance.registerEmbed('newLine', function () {
30
- return {
31
- latex: function latex() {
32
- return '\\embed{newLine}[]';
33
- }
34
- };
35
- });
36
- expect(instance.getMacros().newLine).toEqual('\\htmlData{embed=newLine}{}');
37
- });
38
- it('falls back to a placeholder for an unknown embed', function () {
39
- instance.registerEmbed('somethingCustom', function () {
40
- return {
41
- htmlString: '<b>x</b>'
42
- };
43
- });
44
- expect(instance.getMacros().somethingCustom).toEqual('\\htmlData{embed=somethingCustom}{\\placeholder{}}');
45
- });
46
- it('honours an explicit mathliveLatex from the factory', function () {
47
- instance.registerEmbed('custom', function () {
48
- return {
49
- mathliveLatex: '\\alpha'
50
- };
51
- });
52
- expect(instance.getMacros().custom).toEqual('\\htmlData{embed=custom}{\\alpha}');
53
- });
54
- it('does not throw when the factory throws', function () {
55
- expect(function () {
56
- return instance.registerEmbed('bad', function () {
57
- throw new Error('boom');
58
- });
59
- }).not.toThrow();
60
- expect(instance.registeredEmbeds()).toEqual(['bad']);
61
- });
62
- it('ignores bad arguments', function () {
63
- instance.registerEmbed(undefined, function () {
64
- return {};
65
- });
66
- instance.registerEmbed('noFactory', undefined);
67
- expect(instance.registeredEmbeds()).toEqual([]);
68
- });
69
- it('always includes the pie macro set', function () {
70
- var macros = instance.getMacros();
71
- expect(macros.parallelogram).toBeDefined();
72
- expect(macros.longdiv).toBeDefined();
73
- expect(macros.napprox).toEqual('\\not\\approx');
74
- });
75
-
76
- // Argument-taking macros exist only so previously authored latex parses.
77
- // Editing never goes through them: MathLive serialises a macro from its
78
- // original arguments, so typed content never comes back out.
79
- it('argument-taking macros are plain parse-only definitions', function () {
80
- ['longdiv', 'overarc', 'abs'].forEach(function (name) {
81
- expect((0, _typeof2["default"])(instance.PIE_MACROS[name])).toBe('string');
82
- expect(instance.PIE_MACROS[name]).toContain('#1');
83
- });
84
- });
85
- it('argument-less symbols stay atomic', function () {
86
- ['perpendicular', 'square', 'degree', 'napprox', 'parallelogram'].forEach(function (name) {
87
- expect((0, _typeof2["default"])(instance.PIE_MACROS[name])).toBe('string');
88
- });
89
- });
90
- it('longdiv matches the MathJax macro used by math-rendering', function () {
91
- expect(instance.PIE_MACROS.longdiv).toEqual('\\enclose{longdiv}{#1}');
92
- });
93
- });
94
- describe('applyStaticMath', function () {
95
- it('returns undefined without an element', function () {
96
- expect(instance.applyStaticMath(null, 'x')).toBeUndefined();
97
- });
98
- it('defers (returns undefined) when MathLive has not loaded', function () {
99
- var el = document.createElement('div');
100
- expect(instance.applyStaticMath(el, 'x')).toBeUndefined();
101
- });
102
- it('renders synchronously once MathLive is available', function () {
103
- var el = document.createElement('div');
104
- instance.__setMathLiveForTest({
105
- convertLatexToMarkup: function convertLatexToMarkup(l) {
106
- return "<span>".concat(l, "</span>");
107
- }
108
- });
109
- expect(instance.applyStaticMath(el, '\\pi')).toBe(el);
110
- expect(el.innerHTML).toEqual('<span>\\pi</span>');
111
- });
112
- it('falls back to the element textContent when no latex is passed', function () {
113
- var el = document.createElement('div');
114
- el.textContent = '\\theta';
115
- instance.__setMathLiveForTest({
116
- convertLatexToMarkup: function convertLatexToMarkup(l) {
117
- return "<i>".concat(l, "</i>");
118
- }
119
- });
120
- instance.applyStaticMath(el);
121
- expect(el.innerHTML).toEqual('<i>\\theta</i>');
122
- });
123
- it('bridges stored latex (newLine embed) before rendering', function () {
124
- var el = document.createElement('div');
125
- instance.__setMathLiveForTest({
126
- convertLatexToMarkup: function convertLatexToMarkup(l) {
127
- return l;
128
- }
129
- });
130
- instance.applyStaticMath(el, 'a\\embed{newLine}[]b');
131
-
132
- // \embed{newLine}[] must become a multiline environment
133
- expect(el.innerHTML).toContain('displaylines');
134
- });
135
- });
136
- describe('configureFonts', function () {
137
- // MathLive's default fontsDirectory is the relative './fonts/', which it
138
- // resolves against its own (empty, when bundled) script url and throws
139
- // "Invalid base URL" from loadFonts. Paths must become absolute.
140
- it('is exported and callable before MathLive loads', function () {
141
- expect((0, _typeof2["default"])(instance.configureFonts)).toBe('function');
142
- expect(function () {
143
- return instance.configureFonts('/mathlive-fonts');
144
- }).not.toThrow();
145
- });
146
- it('accepts null to disable font loading', function () {
147
- expect(function () {
148
- return instance.configureFonts(null);
149
- }).not.toThrow();
150
- });
151
- it('applies an absolute url to an already-loaded MathfieldElement', function () {
152
- var MathfieldElement = {};
153
-
154
- // simulate a loaded instance
155
- instance.__setMathLiveForTest({
156
- MathfieldElement: MathfieldElement
157
- });
158
- instance.configureFonts('/mathlive-fonts');
159
- expect(MathfieldElement.fontsDirectory).toEqual("".concat(document.baseURI.replace(/\/$/, ''), "/mathlive-fonts"));
160
- expect(MathfieldElement.fontsDirectory.startsWith('http')).toBe(true);
161
- });
162
- it('leaves a fully-qualified url untouched', function () {
163
- var MathfieldElement = {};
164
- instance.__setMathLiveForTest({
165
- MathfieldElement: MathfieldElement
166
- });
167
- instance.configureFonts('https://cdn.example.com/fonts');
168
- expect(MathfieldElement.fontsDirectory).toEqual('https://cdn.example.com/fonts');
169
- });
170
- it('passes null through rather than resolving it', function () {
171
- var MathfieldElement = {};
172
- instance.__setMathLiveForTest({
173
- MathfieldElement: MathfieldElement
174
- });
175
- instance.configureFonts(null);
176
- expect(MathfieldElement.fontsDirectory).toBeNull();
177
- });
178
- });
179
- describe('latexToMarkup', function () {
180
- it('returns empty string when MathLive is not loaded', function () {
181
- expect(instance.latexToMarkup('\\pi')).toEqual('');
182
- });
183
- it('returns empty string for empty latex', function () {
184
- expect(instance.latexToMarkup('')).toEqual('');
185
- });
186
- });
187
- });
188
- //# sourceMappingURL=mathlive-instance.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mathlive-instance.test.js","names":["describe","instance","beforeEach","jest","resetModules","require","__resetEmbeds","it","registerEmbed","htmlString","latex","expect","registeredEmbeds","toEqual","getMacros","answerBlock","newLine","somethingCustom","mathliveLatex","custom","Error","not","toThrow","undefined","macros","parallelogram","toBeDefined","longdiv","napprox","forEach","name","_typeof2","PIE_MACROS","toBe","toContain","applyStaticMath","toBeUndefined","el","document","createElement","__setMathLiveForTest","convertLatexToMarkup","l","concat","innerHTML","textContent","configureFonts","MathfieldElement","fontsDirectory","baseURI","replace","startsWith","toBeNull","latexToMarkup"],"sources":["../../src/__tests__/mathlive-instance.test.js"],"sourcesContent":["describe('mathlive-instance', () => {\n let instance;\n\n beforeEach(() => {\n jest.resetModules();\n // eslint-disable-next-line global-require\n instance = require('../mathlive-instance');\n instance.__resetEmbeds();\n });\n\n describe('registerEmbed', () => {\n it('registers a known embed and exposes it as a macro', () => {\n instance.registerEmbed('answerBlock', () => ({\n htmlString: '<div class=\"answerBlock\"></div>',\n latex: () => '\\\\embed{answerBlock}[]',\n }));\n\n expect(instance.registeredEmbeds()).toEqual(['answerBlock']);\n // The macro tags output with data-embed so CSS can target it, replacing\n // MathQuill's htmlString hook.\n expect(instance.getMacros().answerBlock).toEqual('\\\\htmlData{embed=answerBlock}{\\\\placeholder{}}');\n });\n\n it('registers newLine as a harmless macro (it is handled by latex-bridge)', () => {\n instance.registerEmbed('newLine', () => ({ latex: () => '\\\\embed{newLine}[]' }));\n\n expect(instance.getMacros().newLine).toEqual('\\\\htmlData{embed=newLine}{}');\n });\n\n it('falls back to a placeholder for an unknown embed', () => {\n instance.registerEmbed('somethingCustom', () => ({ htmlString: '<b>x</b>' }));\n\n expect(instance.getMacros().somethingCustom).toEqual('\\\\htmlData{embed=somethingCustom}{\\\\placeholder{}}');\n });\n\n it('honours an explicit mathliveLatex from the factory', () => {\n instance.registerEmbed('custom', () => ({ mathliveLatex: '\\\\alpha' }));\n\n expect(instance.getMacros().custom).toEqual('\\\\htmlData{embed=custom}{\\\\alpha}');\n });\n\n it('does not throw when the factory throws', () => {\n expect(() =>\n instance.registerEmbed('bad', () => {\n throw new Error('boom');\n }),\n ).not.toThrow();\n\n expect(instance.registeredEmbeds()).toEqual(['bad']);\n });\n\n it('ignores bad arguments', () => {\n instance.registerEmbed(undefined, () => ({}));\n instance.registerEmbed('noFactory', undefined);\n\n expect(instance.registeredEmbeds()).toEqual([]);\n });\n\n it('always includes the pie macro set', () => {\n const macros = instance.getMacros();\n\n expect(macros.parallelogram).toBeDefined();\n expect(macros.longdiv).toBeDefined();\n expect(macros.napprox).toEqual('\\\\not\\\\approx');\n });\n\n // Argument-taking macros exist only so previously authored latex parses.\n // Editing never goes through them: MathLive serialises a macro from its\n // original arguments, so typed content never comes back out.\n it('argument-taking macros are plain parse-only definitions', () => {\n ['longdiv', 'overarc', 'abs'].forEach((name) => {\n expect(typeof instance.PIE_MACROS[name]).toBe('string');\n expect(instance.PIE_MACROS[name]).toContain('#1');\n });\n });\n\n it('argument-less symbols stay atomic', () => {\n ['perpendicular', 'square', 'degree', 'napprox', 'parallelogram'].forEach((name) => {\n expect(typeof instance.PIE_MACROS[name]).toBe('string');\n });\n });\n\n it('longdiv matches the MathJax macro used by math-rendering', () => {\n expect(instance.PIE_MACROS.longdiv).toEqual('\\\\enclose{longdiv}{#1}');\n });\n });\n\n describe('applyStaticMath', () => {\n it('returns undefined without an element', () => {\n expect(instance.applyStaticMath(null, 'x')).toBeUndefined();\n });\n\n it('defers (returns undefined) when MathLive has not loaded', () => {\n const el = document.createElement('div');\n\n expect(instance.applyStaticMath(el, 'x')).toBeUndefined();\n });\n\n it('renders synchronously once MathLive is available', () => {\n const el = document.createElement('div');\n\n instance.__setMathLiveForTest({ convertLatexToMarkup: (l) => `<span>${l}</span>` });\n\n expect(instance.applyStaticMath(el, '\\\\pi')).toBe(el);\n expect(el.innerHTML).toEqual('<span>\\\\pi</span>');\n });\n\n it('falls back to the element textContent when no latex is passed', () => {\n const el = document.createElement('div');\n\n el.textContent = '\\\\theta';\n instance.__setMathLiveForTest({ convertLatexToMarkup: (l) => `<i>${l}</i>` });\n instance.applyStaticMath(el);\n\n expect(el.innerHTML).toEqual('<i>\\\\theta</i>');\n });\n\n it('bridges stored latex (newLine embed) before rendering', () => {\n const el = document.createElement('div');\n\n instance.__setMathLiveForTest({ convertLatexToMarkup: (l) => l });\n instance.applyStaticMath(el, 'a\\\\embed{newLine}[]b');\n\n // \\embed{newLine}[] must become a multiline environment\n expect(el.innerHTML).toContain('displaylines');\n });\n });\n\n describe('configureFonts', () => {\n // MathLive's default fontsDirectory is the relative './fonts/', which it\n // resolves against its own (empty, when bundled) script url and throws\n // \"Invalid base URL\" from loadFonts. Paths must become absolute.\n it('is exported and callable before MathLive loads', () => {\n expect(typeof instance.configureFonts).toBe('function');\n expect(() => instance.configureFonts('/mathlive-fonts')).not.toThrow();\n });\n\n it('accepts null to disable font loading', () => {\n expect(() => instance.configureFonts(null)).not.toThrow();\n });\n\n it('applies an absolute url to an already-loaded MathfieldElement', () => {\n const MathfieldElement = {};\n\n // simulate a loaded instance\n instance.__setMathLiveForTest({ MathfieldElement });\n instance.configureFonts('/mathlive-fonts');\n\n expect(MathfieldElement.fontsDirectory).toEqual(`${document.baseURI.replace(/\\/$/, '')}/mathlive-fonts`);\n expect(MathfieldElement.fontsDirectory.startsWith('http')).toBe(true);\n });\n\n it('leaves a fully-qualified url untouched', () => {\n const MathfieldElement = {};\n\n instance.__setMathLiveForTest({ MathfieldElement });\n instance.configureFonts('https://cdn.example.com/fonts');\n\n expect(MathfieldElement.fontsDirectory).toEqual('https://cdn.example.com/fonts');\n });\n\n it('passes null through rather than resolving it', () => {\n const MathfieldElement = {};\n\n instance.__setMathLiveForTest({ MathfieldElement });\n instance.configureFonts(null);\n\n expect(MathfieldElement.fontsDirectory).toBeNull();\n });\n });\n\n describe('latexToMarkup', () => {\n it('returns empty string when MathLive is not loaded', () => {\n expect(instance.latexToMarkup('\\\\pi')).toEqual('');\n });\n\n it('returns empty string for empty latex', () => {\n expect(instance.latexToMarkup('')).toEqual('');\n });\n });\n});\n"],"mappings":";;;;AAAAA,QAAQ,CAAC,mBAAmB,EAAE,YAAM;EAClC,IAAIC,QAAQ;EAEZC,UAAU,CAAC,YAAM;IACfC,IAAI,CAACC,YAAY,CAAC,CAAC;IACnB;IACAH,QAAQ,GAAGI,OAAO,CAAC,sBAAsB,CAAC;IAC1CJ,QAAQ,CAACK,aAAa,CAAC,CAAC;EAC1B,CAAC,CAAC;EAEFN,QAAQ,CAAC,eAAe,EAAE,YAAM;IAC9BO,EAAE,CAAC,mDAAmD,EAAE,YAAM;MAC5DN,QAAQ,CAACO,aAAa,CAAC,aAAa,EAAE;QAAA,OAAO;UAC3CC,UAAU,EAAE,iCAAiC;UAC7CC,KAAK,EAAE,SAAPA,KAAKA,CAAA;YAAA,OAAQ,wBAAwB;UAAA;QACvC,CAAC;MAAA,CAAC,CAAC;MAEHC,MAAM,CAACV,QAAQ,CAACW,gBAAgB,CAAC,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;MAC5D;MACA;MACAF,MAAM,CAACV,QAAQ,CAACa,SAAS,CAAC,CAAC,CAACC,WAAW,CAAC,CAACF,OAAO,CAAC,gDAAgD,CAAC;IACpG,CAAC,CAAC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