Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function parseAttributes(attributes: string) {

function parseString(value = '') {
const result = value
.replace(/\r?\n|\r/g, '')
.replace(/\r?\n|\r/g, ' ')
.replace(/\s{2,}/g, ' ')
.replace(/ /, '\u00A0');

Expand Down
6 changes: 3 additions & 3 deletions tests/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const testClass = 'testClass';
const testCss = '.image { background: orange; }';
const testUrl = 'https://jameshill.dev/?option=123456&section=top';
const testImage = 'https://via.placeholder.com/150';
const testSentence = `<p><strong>${testWord}</strong> <em>${testWord}</em> &nbsp; ${testWord}?</p>`;
const testSentence = `<p><strong>${testWord}</strong> <em>${testWord}</em> &nbsp; ${testWord}\n${testWord}?</p>`;
const testAnchor = `<a href="${testUrl}">${testWord}</a>`;

const testHtml = `
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('parse()', () => {
const result = parse(testSentence) as JSX.Element;
const instance = mount(result);

expect(instance.text()).toEqual(`${testWord} ${testWord} ${testWord}?`);
expect(instance.text()).toEqual(`${testWord} ${testWord} ${testWord} ${testWord}?`);
});
});

Expand Down Expand Up @@ -197,7 +197,7 @@ describe('parse()', () => {
const result = parse(testSentence) as JSX.Element;
const instance = mount(result);

expect(instance.text()).toEqual(`${testWord} ${testWord} ${testWord}?`);
expect(instance.text()).toEqual(`${testWord} ${testWord} ${testWord} ${testWord}?`);
});
});
});