Extract text inside a text:a tag and create a test

This commit is contained in:
Clémence Fernandez 2025-09-18 09:58:34 +02:00
parent 38260814cb
commit ebca8d0223
3 changed files with 29 additions and 9 deletions

View File

@ -34,7 +34,7 @@ function extraxtODSCellText(cell) {
} else if (pChild.nodeName === 'text:line-break') {
text += '\n'; // Append newline for <text:line-break />
} else if (pChild.nodeName === 'text:a') {
text += pChild.nodeName
text += pChild.textContent
}
}
} else if (child.nodeName === 'text:line-break') {

BIN
tests/fixtures/cellules avec emails.ods vendored Normal file

Binary file not shown.

View File

@ -56,3 +56,23 @@ Si t'es pas comme eux quand t'es naturel`
t.deepEqual(feuille1[0][0].value, expectedValue)
});
test('.ods cells with mails should be recognized', async t => {
const odsFileWithEmails = (await readFile('./tests/fixtures/cellules avec emails.ods')).buffer
const table = await getODSTableRawContent(odsFileWithEmails);
const feuille1 = table.get('Feuille1')
const row1 = feuille1[0]
t.deepEqual(row1[0].value, 'Nom')
t.deepEqual(row1[1].value, 'Email')
const row2 = feuille1[1]
t.deepEqual(row2[0].value, 'Dav')
t.deepEqual(row2[1].value, 'david@mail.fr')
const row3 = feuille1[2]
t.deepEqual(row3[0].value, 'Fanny')
t.deepEqual(row3[1].value, 'lemaildeFanny@cemail.com')
});