From 19354b0c19ec1fb00b129a9fa72dcd6981d64835 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Sat, 22 Feb 2020 20:15:09 +0800
Subject: [PATCH] docs: update rate demo
---
.../rate/__tests__/__snapshots__/demo.test.js.snap | 6 ++----
components/rate/__tests__/index.test.js | 2 ++
components/rate/demo/clear.md | 7 ++++---
components/rate/index.jsx | 10 +++++-----
4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/components/rate/__tests__/__snapshots__/demo.test.js.snap b/components/rate/__tests__/__snapshots__/demo.test.js.snap
index 6ee092615..a3ec3c6a5 100644
--- a/components/rate/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/rate/__tests__/__snapshots__/demo.test.js.snap
@@ -229,8 +229,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
- allowClear: true
-
+ allowClear: true
allowClear: false
-
+ allowClear: false
`;
diff --git a/components/rate/__tests__/index.test.js b/components/rate/__tests__/index.test.js
index 36295752f..3944c14c4 100644
--- a/components/rate/__tests__/index.test.js
+++ b/components/rate/__tests__/index.test.js
@@ -1,6 +1,8 @@
import Rate from '..';
import focusTest from '../../../tests/shared/focusTest';
+import mountTest from '../../../tests/shared/mountTest';
describe('Rate', () => {
focusTest(Rate);
+ mountTest(Rate);
});
diff --git a/components/rate/demo/clear.md b/components/rate/demo/clear.md
index 44a4a24b6..3f91786a6 100644
--- a/components/rate/demo/clear.md
+++ b/components/rate/demo/clear.md
@@ -11,10 +11,11 @@ Support set allow to clear star when click again.
```tpl
-
allowClear: true
-
-
allowClear: false
+
+
allowClear: true
+
+
allowClear: false
```
diff --git a/components/rate/index.jsx b/components/rate/index.jsx
index f92c14239..0188deb51 100644
--- a/components/rate/index.jsx
+++ b/components/rate/index.jsx
@@ -31,17 +31,17 @@ const Rate = {
configProvider: { default: () => ConfigConsumerProps },
},
methods: {
+ characterRender(node, { index }) {
+ const { tooltips } = this.$props;
+ if (!tooltips) return node;
+ return {node};
+ },
focus() {
this.$refs.refRate.focus();
},
blur() {
this.$refs.refRate.blur();
},
- characterRender(node, { index }) {
- const { tooltips } = this.$props;
- if (!tooltips) return node;
- return {node};
- },
},
render() {
const { prefixCls: customizePrefixCls, ...restProps } = getOptionProps(this);