// Word's horizontal line is a VML rect (o:hr) in a paragraph of its own; the editor
// draws it as that paragraph's bottom rule instead of dropping it as a shape.
import { describe, it, expect } from 'vitest';
import { zipSync, strToU8 } from 'fflate';
import { importDocx } from '../../src/lib/import/docx';
const doc = (body: string) => zipSync({
'word/document.xml': strToU8(`
${body}
`),
});
const HR = '';
describe('DOCX horizontal line', () => {
it('becomes the paragraph bottom rule, with no warning', () => {
const res = importDocx(doc(`Text${HR}`));
const rule = res.content.content[1];
expect(rule.attrs.borderBottom).toBe('1.5pt solid #A0A0A0');
expect([...res.warnings]).not.toContain('Drawings were removed');
});
it('leaves a real w:pBdr bottom border alone', () => {
const bdr = '';
const res = importDocx(doc(HR.replace('', `${bdr}`)));
expect(res.content.content[0].attrs.borderBottom).toBe('3pt solid #FF0000');
});
});