feat: update comment

pull/1790/head
tangjinzhou 2020-02-11 15:34:58 +08:00
parent c0b92c6c50
commit 2875d57a25
6 changed files with 10 additions and 8 deletions

View File

@ -70,7 +70,7 @@ exports[`renders ./components/comment/demo/list.md correctly 1`] = `
<div class="ant-list-item-content ant-list-item-content-single"> <div class="ant-list-item-content ant-list-item-content-single">
<div class="ant-comment"> <div class="ant-comment">
<div class="ant-comment-inner"> <div class="ant-comment-inner">
<div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"></div> <div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="comment-avatar"></div>
<div class="ant-comment-content"> <div class="ant-comment-content">
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span><span class="ant-comment-content-author-time"><span class="">a day ago</span></span></div> <div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span><span class="ant-comment-content-author-time"><span class="">a day ago</span></span></div>
<div class="ant-comment-content-detail"> <div class="ant-comment-content-detail">
@ -88,7 +88,7 @@ exports[`renders ./components/comment/demo/list.md correctly 1`] = `
<div class="ant-list-item-content ant-list-item-content-single"> <div class="ant-list-item-content ant-list-item-content-single">
<div class="ant-comment"> <div class="ant-comment">
<div class="ant-comment-inner"> <div class="ant-comment-inner">
<div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"></div> <div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="comment-avatar"></div>
<div class="ant-comment-content"> <div class="ant-comment-content">
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span><span class="ant-comment-content-author-time"><span class="">2 days ago</span></span></div> <div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span><span class="ant-comment-content-author-time"><span class="">2 days ago</span></span></div>
<div class="ant-comment-content-detail"> <div class="ant-comment-content-detail">

View File

@ -10,7 +10,7 @@ exports[`Comment Comment can be used as editor, user can customize the editor co
<div class="ant-list-item-content ant-list-item-content-single"> <div class="ant-list-item-content ant-list-item-content-single">
<div class="ant-comment"> <div class="ant-comment">
<div class="ant-comment-inner"> <div class="ant-comment-inner">
<div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"></div> <div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="comment-avatar"></div>
<div class="ant-comment-content"> <div class="ant-comment-content">
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span><span class="ant-comment-content-author-time">a few seconds ago</span></div> <div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span><span class="ant-comment-content-author-time">a few seconds ago</span></div>
<div class="ant-comment-content-detail">222</div> <div class="ant-comment-content-detail">222</div>

View File

@ -6,6 +6,7 @@ import List from '../../list';
import Form from '../../form'; import Form from '../../form';
import Button from '../../button'; import Button from '../../button';
import Input from '../../input'; import Input from '../../input';
import mountTest from '../../../tests/shared/mountTest';
const CommentTest = { const CommentTest = {
data() { data() {
@ -87,6 +88,7 @@ const CommentTest = {
}; };
describe('Comment', () => { describe('Comment', () => {
mountTest(Comment);
it('Comment can be used as editor, user can customize the editor component.', async () => { it('Comment can be used as editor, user can customize the editor component.', async () => {
const wrapper = mount(CommentTest, { const wrapper = mount(CommentTest, {
sync: false, sync: false,

View File

@ -12,7 +12,7 @@ A basic comment with author, avatar, time and actions.
<template> <template>
<a-comment> <a-comment>
<template slot="actions"> <template slot="actions">
<span> <span key="comment-basic-like">
<a-tooltip title="Like"> <a-tooltip title="Like">
<a-icon type="like" :theme="action === 'liked' ? 'filled' : 'outlined'" @click="like" /> <a-icon type="like" :theme="action === 'liked' ? 'filled' : 'outlined'" @click="like" />
</a-tooltip> </a-tooltip>
@ -20,7 +20,7 @@ A basic comment with author, avatar, time and actions.
{{likes}} {{likes}}
</span> </span>
</span> </span>
<span> <span key="comment-basic-dislike">
<a-tooltip title="Dislike"> <a-tooltip title="Dislike">
<a-icon <a-icon
type="dislike" type="dislike"
@ -32,7 +32,7 @@ A basic comment with author, avatar, time and actions.
{{dislikes}} {{dislikes}}
</span> </span>
</span> </span>
<span>Reply to</span> <span key="comment-basic-reply-to">Reply to</span>
</template> </template>
<a slot="author">Han Solo</a> <a slot="author">Han Solo</a>
<a-avatar <a-avatar

View File

@ -11,7 +11,7 @@ Comments can be nested.
```tpl ```tpl
<template> <template>
<a-comment> <a-comment>
<span slot="actions">Reply to</span> <span slot="actions" key="comment-nested-reply-to">Reply to</span>
<a slot="author">Han Solo</a> <a slot="author">Han Solo</a>
<a-avatar <a-avatar
slot="avatar" slot="avatar"

View File

@ -49,7 +49,7 @@ const Comment = {
const avatarDom = ( const avatarDom = (
<div class={`${prefixCls}-avatar`}> <div class={`${prefixCls}-avatar`}>
{typeof avatar === 'string' ? <img src={avatar} /> : avatar} {typeof avatar === 'string' ? <img src={avatar} alt="comment-avatar" /> : avatar}
</div> </div>
); );