Merge branch 'fix-mentions-new-bugs' into shigusegubu
* fix-mentions-new-bugs: new unit tests fix unit tests enable link handling in user bios to fix links not having _blank add emoji to chat titles use rich content in interaction lists
This commit is contained in:
commit
5076c96b89
4 changed files with 93 additions and 14 deletions
|
@ -1,5 +1,4 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- eslint-disable vue/no-v-html -->
|
|
||||||
<div
|
<div
|
||||||
class="chat-title"
|
class="chat-title"
|
||||||
:title="title"
|
:title="title"
|
||||||
|
@ -14,12 +13,13 @@
|
||||||
height="23px"
|
height="23px"
|
||||||
/>
|
/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<span
|
<RichContent
|
||||||
class="username"
|
class="username"
|
||||||
v-html="htmlTitle"
|
:title="'@'+user.screen_name_ui"
|
||||||
|
:html="htmlTitle"
|
||||||
|
:emoji="user.emoji"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- eslint-enable vue/no-v-html -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script src="./chat_title.js"></script>
|
<script src="./chat_title.js"></script>
|
||||||
|
@ -34,6 +34,8 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
--emoji-size: 14px;
|
||||||
|
|
||||||
.username {
|
.username {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
@ -41,14 +43,6 @@
|
||||||
display: inline;
|
display: inline;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
|
||||||
|
|
||||||
.emoji {
|
|
||||||
width: 14px;
|
|
||||||
height: 14px;
|
|
||||||
vertical-align: middle;
|
|
||||||
object-fit: contain
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Avatar {
|
.Avatar {
|
||||||
|
|
|
@ -275,6 +275,7 @@
|
||||||
class="user-card-bio"
|
class="user-card-bio"
|
||||||
:html="user.description_html"
|
:html="user.description_html"
|
||||||
:emoji="user.emoji"
|
:emoji="user.emoji"
|
||||||
|
:handle-links="true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,7 +22,12 @@
|
||||||
/>
|
/>
|
||||||
<div class="user-list-names">
|
<div class="user-list-names">
|
||||||
<!-- eslint-disable vue/no-v-html -->
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
<span v-html="user.name_html" />
|
<RichContent
|
||||||
|
class="username"
|
||||||
|
:title="'@'+user.screen_name_ui"
|
||||||
|
:html="user.name_html"
|
||||||
|
:emoji="user.emoji"
|
||||||
|
/>
|
||||||
<!-- eslint-enable vue/no-v-html -->
|
<!-- eslint-enable vue/no-v-html -->
|
||||||
<span class="user-list-screen-name">{{ user.screen_name_ui }}</span>
|
<span class="user-list-screen-name">{{ user.screen_name_ui }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,6 +53,8 @@
|
||||||
.user-list-popover {
|
.user-list-popover {
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
|
||||||
|
--emoji-size: 16px;
|
||||||
|
|
||||||
.user-list-row {
|
.user-list-row {
|
||||||
padding: 0.25em;
|
padding: 0.25em;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -350,7 +350,6 @@ describe('RichContent', () => {
|
||||||
'<span>',
|
'<span>',
|
||||||
'</span>',
|
'</span>',
|
||||||
'</a>',
|
'</a>',
|
||||||
' ',
|
|
||||||
'<!---->', // v-if placeholder, mentionlink's "new" (i.e. rich) display
|
'<!---->', // v-if placeholder, mentionlink's "new" (i.e. rich) display
|
||||||
'</span>',
|
'</span>',
|
||||||
'<!---->', // v-if placeholder, mentionsline's extra mentions and stuff
|
'<!---->', // v-if placeholder, mentionsline's extra mentions and stuff
|
||||||
|
@ -375,6 +374,84 @@ describe('RichContent', () => {
|
||||||
expect(wrapper.html()).to.eql(compwrap(expected))
|
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', () => {
|
it('rich contents of a link are handled properly', () => {
|
||||||
const html = [
|
const html = [
|
||||||
'<p>',
|
'<p>',
|
||||||
|
|
Loading…
Add table
Reference in a new issue