diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index ce562f1370..79acd1dec0 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -121,14 +121,13 @@ export default Vue.component('RichContent', { if (emptyText) { return encounteredText ? item : item.trim() } - let unescapedItem = unescape(item) if (!encounteredText) { - unescapedItem = unescapedItem.trimStart() + item = item.trimStart() encounteredText = true } if (item.includes(':')) { - unescapedItem = ['', processTextForEmoji( - unescapedItem, + item = ['', processTextForEmoji( + item, this.emoji, ({ shortcode, url }) => { return { newChildren } diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index 96c480eade..fbf8973dc1 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -27,6 +27,29 @@ describe('RichContent', () => { expect(wrapper.html()).to.eql(compwrap(html)) }) + it('unescapes everything as needed', () => { + const html = [ + p('Testing 'em all'), + 'Testing 'em all' + ].join('') + const expected = [ + p('Testing \'em all'), + 'Testing \'em all' + ].join('') + const wrapper = shallowMount(RichContent, { + localVue, + propsData: { + hideMentions: true, + handleLinks: true, + greentext: true, + emoji: [], + html + } + }) + + expect(wrapper.html()).to.eql(compwrap(expected)) + }) + it('removes mentions from the beginning of post', () => { const html = p( makeMention('John'),