diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index fbf8973d..9ac9bedb 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -2,8 +2,12 @@ import { mount, shallowMount, createLocalVue } from '@vue/test-utils' import RichContent from 'src/components/rich_content/rich_content.jsx' const localVue = createLocalVue() +const attentions = [] -const makeMention = (who) => `@${who}` +const makeMention = (who) => { + attentions.push({ statusnet_profile_url: `https://fake.tld/@${who}` }) + return `@${who}` +} const stubMention = (who) => `` const lastMentions = (...data) => `${data.join('')}` const p = (...data) => `

${data.join('')}

` @@ -16,6 +20,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -39,6 +44,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -62,6 +68,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -89,6 +96,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -120,6 +128,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -157,6 +166,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -186,6 +196,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -215,6 +226,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -257,6 +269,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -292,6 +305,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -334,6 +348,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -362,6 +377,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: true, @@ -386,6 +402,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: true, @@ -406,6 +423,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -427,6 +445,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -444,6 +463,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -472,6 +492,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, handleLinks: true, greentext: true, emoji: [], @@ -507,6 +528,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -537,6 +559,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -580,6 +603,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -616,6 +640,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -652,6 +677,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -699,6 +725,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -711,6 +738,7 @@ describe('RichContent', () => { }) it('rich contents of a mention in beginning are handled properly', () => { + attentions.push({ statusnet_profile_url: 'lol' }) const html = [ p( '', @@ -752,6 +780,7 @@ describe('RichContent', () => { MentionLink: true }, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -796,6 +825,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true,