diff options
| author | Henry Jameson <me@hjkos.com> | 2022-02-19 23:04:51 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2022-02-19 23:04:51 +0200 |
| commit | 86e3aefdab3fa1314d4731eabcf03f8c9e418e41 (patch) | |
| tree | cf88bf5c7ec928f5b00ed01818d39f0acfcc9d18 /test/unit/specs/components | |
| parent | a8d198768639435bad93a527228f62575eed37c0 (diff) | |
new unit tests
Diffstat (limited to 'test/unit/specs/components')
| -rw-r--r-- | test/unit/specs/components/rich_content.spec.js | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index 8a29bd6e..30c66a33 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -374,6 +374,84 @@ describe('RichContent', () => { expect(wrapper.html()).to.eql(compwrap(expected)) }) + it('rich contents of nested mentions are handled properly', () => { + attentions.push({ statusnet_profile_url: 'lol' }) + const html = [ + p( + '<span class="poast-style">', + '<a href="lol" class="mention">', + '<span>', + 'https://</span>', + '<span>', + 'lol.tld/</span>', + '<span>', + '</span>', + '</a>', + ' ', + '<a href="lol" class="mention">', + '<span>', + 'https://</span>', + '<span>', + 'lol.tld/</span>', + '<span>', + '</span>', + '</a>', + '</span>' + ), + p( + 'Testing' + ) + ].join('') + const expected = [ + p( + '<span class="poast-style">', + '<span class="MentionsLine">', + '<span class="MentionLink mention-link">', + '<a href="lol" target="_blank" class="original">', + '<span>', + 'https://</span>', + '<span>', + 'lol.tld/</span>', + '<span>', + '</span>', + '</a>', + '<!---->', // v-if placeholder, mentionlink's "new" (i.e. rich) display + '</span>', + '<span class="MentionLink mention-link">', + '<a href="lol" target="_blank" class="original">', + '<span>', + 'https://</span>', + '<span>', + 'lol.tld/</span>', + '<span>', + '</span>', + '</a>', + '<!---->', // v-if placeholder, mentionlink's "new" (i.e. rich) display + '</span>', + '<!---->', // v-if placeholder, mentionsline's extra mentions and stuff + '</span>', + '</span>' + ), + ' ', + p( + 'Testing' + ) + ].join('') + + const wrapper = mount(RichContent, { + localVue, + propsData: { + attentions, + handleLinks: true, + greentext: true, + emoji: [], + html + } + }) + + expect(wrapper.html()).to.eql(compwrap(expected)) + }) + it('rich contents of a link are handled properly', () => { const html = [ '<p>', |
