From df83968de422642b23e7339fdbc9c67aea015739 Mon Sep 17 00:00:00 2001
From: tanjinzhou <415800467@qq.com>
Date: Tue, 28 Jul 2020 17:10:59 +0800
Subject: [PATCH] test: update comment test
---
antdv-demo | 2 +-
.../__snapshots__/index.test.js.snap | 26 +++++++++--
components/comment/__tests__/index.test.js | 44 ++++++++++---------
components/comment/index.jsx | 4 +-
components/tooltip/Tooltip.jsx | 5 ++-
examples/App.vue | 2 +-
6 files changed, 53 insertions(+), 30 deletions(-)
diff --git a/antdv-demo b/antdv-demo
index 432632788..51cd1e3ae 160000
--- a/antdv-demo
+++ b/antdv-demo
@@ -1 +1 @@
-Subproject commit 4326327888f185e994eb7071d0b0b5edb1be2768
+Subproject commit 51cd1e3aea790432b220a7233ba189899438f031
diff --git a/components/comment/__tests__/__snapshots__/index.test.js.snap b/components/comment/__tests__/__snapshots__/index.test.js.snap
index 6374ae36a..4bff5d290 100644
--- a/components/comment/__tests__/__snapshots__/index.test.js.snap
+++ b/components/comment/__tests__/__snapshots__/index.test.js.snap
@@ -3,8 +3,10 @@
exports[`Comment Comment can be used as editor, user can customize the editor component. 1`] = `
+
+
-
@@ -14,39 +16,55 @@ exports[`Comment Comment can be used as editor, user can customize the editor co
+
+
+
+
+
);
},
@@ -98,11 +102,11 @@ describe('Comment', () => {
wrapper.find('textarea').trigger('input');
});
await asyncExpect(() => {
- wrapper.find('Button').trigger('click');
+ wrapper.find('.ant-btn').trigger('click');
});
await asyncExpect(() => {
- expect(wrapper.findAll('.ant-list-header').wrappers[0].element.innerHTML).toBe('1 reply');
+ expect(wrapper.findAll('.ant-list-header')[0].element.innerHTML).toBe('1 reply');
expect(wrapper.html()).toMatchSnapshot();
}, 2000);
});
diff --git a/components/comment/index.jsx b/components/comment/index.jsx
index 10d5797aa..0d489e09b 100644
--- a/components/comment/index.jsx
+++ b/components/comment/index.jsx
@@ -1,6 +1,6 @@
import { inject } from 'vue';
import PropsTypes from '../_util/vue-types';
-import { getComponent } from '../_util/props-util';
+import { getComponent, getSlot } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
export const CommentProps = {
actions: PropsTypes.array,
@@ -81,7 +81,7 @@ const Comment = {
{contentDom}
);
- const children = this.$slots.default && this.$slots.default();
+ const children = getSlot(this);
return (
{comment}
diff --git a/components/tooltip/Tooltip.jsx b/components/tooltip/Tooltip.jsx
index 7272f5296..571dc4ce9 100644
--- a/components/tooltip/Tooltip.jsx
+++ b/components/tooltip/Tooltip.jsx
@@ -1,5 +1,6 @@
import { inject } from 'vue';
import VcTooltip from '../vc-tooltip';
+import classNames from 'classnames';
import getPlacements from './placements';
import PropTypes from '../_util/vue-types';
import {
@@ -186,10 +187,10 @@ export default {
const child = this.getDisabledCompatibleChildren(
isValidElement(children) ? children : {children},
);
- const childCls = {
+ const childCls = classNames({
[openClassName || `${prefixCls}-open`]: sVisible,
[child.props && child.props.class]: child.props && child.props.class,
- };
+ });
const tooltipProps = {
...$attrs,
...$props,
diff --git a/examples/App.vue b/examples/App.vue
index 7bea37525..e3416a046 100644
--- a/examples/App.vue
+++ b/examples/App.vue
@@ -4,7 +4,7 @@