Skip to content

Commit 19354b0

Browse files
committed
docs: update rate demo
1 parent 88f2859 commit 19354b0

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

components/rate/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
229229
</svg></i></div>
230230
</div>
231231
</li>
232-
</ul> allowClear: true
233-
<br>
232+
</ul> <span class="ant-rate-text">allowClear: true</span> <br>
234233
<ul tabindex="0" role="radiogroup" class="ant-rate">
235234
<li class="ant-rate-star ant-rate-star-full">
236235
<div role="radio" aria-checked="true" aria-posinset="1" aria-setsize="5" tabindex="0">
@@ -282,8 +281,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
282281
</svg></i></div>
283282
</div>
284283
</li>
285-
</ul> allowClear: false
286-
<br>
284+
</ul> <span class="ant-rate-text">allowClear: false</span>
287285
</div>
288286
`;
289287
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Rate from '..';
22
import focusTest from '../../../tests/shared/focusTest';
3+
import mountTest from '../../../tests/shared/mountTest';
34

45
describe('Rate', () => {
56
focusTest(Rate);
7+
mountTest(Rate);
68
});

components/rate/demo/clear.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ Support set allow to clear star when click again.
1111
```tpl
1212
<template>
1313
<div>
14-
<a-rate :defaultValue="3" /> allowClear: true
15-
<br />
16-
<a-rate :allowClear="false" :defaultValue="3" /> allowClear: false
14+
<a-rate :defaultValue="3" />
15+
<span class="ant-rate-text">allowClear: true</span>
1716
<br />
17+
<a-rate :allowClear="false" :defaultValue="3" />
18+
<span class="ant-rate-text">allowClear: false</span>
1819
</div>
1920
</template>
2021
```

components/rate/index.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ const Rate = {
3131
configProvider: { default: () => ConfigConsumerProps },
3232
},
3333
methods: {
34+
characterRender(node, { index }) {
35+
const { tooltips } = this.$props;
36+
if (!tooltips) return node;
37+
return <Tooltip title={tooltips[index]}>{node}</Tooltip>;
38+
},
3439
focus() {
3540
this.$refs.refRate.focus();
3641
},
3742
blur() {
3843
this.$refs.refRate.blur();
3944
},
40-
characterRender(node, { index }) {
41-
const { tooltips } = this.$props;
42-
if (!tooltips) return node;
43-
return <Tooltip title={tooltips[index]}>{node}</Tooltip>;
44-
},
4545
},
4646
render() {
4747
const { prefixCls: customizePrefixCls, ...restProps } = getOptionProps(this);

0 commit comments

Comments
 (0)