From 8fe4355a6b84ae81b54228e6749a4ab82966ff2e Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 18 Jun 2021 21:29:47 +0300 Subject: [PATCH] fix rich images --- src/services/html_converter/html_line_converter.service.js | 2 ++ .../services/html_converter/html_line_converter.spec.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/services/html_converter/html_line_converter.service.js b/src/services/html_converter/html_line_converter.service.js index f43d162a..74103b02 100644 --- a/src/services/html_converter/html_line_converter.service.js +++ b/src/services/html_converter/html_line_converter.service.js @@ -114,6 +114,8 @@ export const convertHtmlToLines = (html) => { } else { handleOpen(tagFull) } + } else { + textBuffer += tagFull } } else { textBuffer += tagFull diff --git a/test/unit/specs/services/html_converter/html_line_converter.spec.js b/test/unit/specs/services/html_converter/html_line_converter.spec.js index de7c7fc2..86bd7e8b 100644 --- a/test/unit/specs/services/html_converter/html_line_converter.spec.js +++ b/test/unit/specs/services/html_converter/html_line_converter.spec.js @@ -69,6 +69,13 @@ describe('html_line_converter', () => { const comparableResult = result.map(mapOnlyText(processorKeep)).join('') expect(comparableResult).to.eql(inputOutput) }) + + it('fed with some recognized but not handled elements', () => { + const inputOutput = 'testing images\n\n' + const result = convertHtmlToLines(inputOutput) + const comparableResult = result.map(mapOnlyText(processorKeep)).join('') + expect(comparableResult).to.eql(inputOutput) + }) }) describe('with processor that replaces lines with word "_" should match expected line when', () => { const processorReplace = (line) => '_'