diff --git a/src/docsSoap.js b/src/docsSoap.js index 0ebf999..ab00519 100644 --- a/src/docsSoap.js +++ b/src/docsSoap.js @@ -106,6 +106,8 @@ const getCleanNode = ( } else if (node.nodeName === 'P') { newWrapper = document.createElement('p'); newNode = applyBlockStyles(node); + } else if (node.nodeName === 'BR') { + newNode = node; } else { newWrapper = document.createElement('span'); newNode = applyInlineStyles(node); diff --git a/test/docsSoapSpec.js b/test/docsSoapSpec.js index 9a2ce3a..1479aab 100644 --- a/test/docsSoapSpec.js +++ b/test/docsSoapSpec.js @@ -106,4 +106,9 @@ describe('Google Docs Converter', () => { expect(doc.querySelectorAll('h3').length).toBe(1); expect(doc.querySelectorAll('h4').length).toBe(1); }); + + it('converts brs properly', () => { + const doc = parseHTML(docsSoap(documents.brs)); + expect(doc.querySelectorAll('br').length).toBe(2); + }); }); diff --git a/test/fixtures/documents.json b/test/fixtures/documents.json index 5328ae9..38b0ec3 100644 --- a/test/fixtures/documents.json +++ b/test/fixtures/documents.json @@ -3,5 +3,6 @@ "inlineStyles": "
Some bold text
Some italicized text
Some underlined text
Some strikethrough text
Some superscript
Some subscript", "links": "this is a bold, italicized link", "nestedList": "Abcd
1234
In abcd
Some text in italics and underline plus random stuff after
xyz
In xyz
Last of all
Todo 1
Todo 2
subtodo
subsubsub
Asdfasdf
2. End
Asdfasdfasdf
Asdfasdfasdfasdf
Asdfasdfasdf
asdfasdfasdfasf
Asdfasdf
2. end
end
asdfasdf
s
dfa
sdf
eight
ten