import {createWord} from './EmptyWord';
import {mergeRun} from '../src/util/mergeRun';
import {parseXML} from '../src/util/xml';
test('proofErr', async () => {
const xmlDoc = parseXML(
`
{{var
}}
`.trim()
);
const word = createWord();
mergeRun(word, xmlDoc);
expect(xmlDoc.getElementsByTagName('w:t')[0]?.innerHTML).toBe('{{var}}');
});
test('font hint', async () => {
const xmlDoc = parseXML(
`
B
6
`.trim()
);
const word = createWord();
mergeRun(word, xmlDoc);
expect(xmlDoc.getElementsByTagName('w:t')[0]?.innerHTML).toBe('B6');
});
test('space', async () => {
const xmlDoc = parseXML(
`
C
ustom
Style
`.trim()
);
const word = createWord();
mergeRun(word, xmlDoc);
expect(xmlDoc.getElementsByTagName('w:t')[0]?.innerHTML).toBe('Custom');
});
test('multi_proofErr', async () => {
const xmlDoc = parseXML(
`
{{
operate_
applicant.label
}}
`.trim()
);
const word = createWord();
mergeRun(word, xmlDoc);
expect(xmlDoc.getElementsByTagName('w:t')[0]?.innerHTML).toBe(
'{{operate_applicant.label}}'
);
});
test('multi_run', async () => {
const xmlDoc = parseXML(
`
{
{
operate
_
a
pplicate
_u
nit
.label
}}
`.trim()
);
const word = createWord();
mergeRun(word, xmlDoc);
expect(xmlDoc.getElementsByTagName('w:t')[0]?.innerHTML).toBe(
'{{operate_applicate_unit.label}}'
);
});
test('error_proof', async () => {
const xmlDoc = parseXML(
`
{{
operate_work_type
.
label
}}
`.trim()
);
const word = createWord();
mergeRun(word, xmlDoc);
expect(xmlDoc.getElementsByTagName('w:t')[0]?.innerHTML).toBe(
'{{operate_work_type.label}}'
);
});