diff --git a/src/rate/__tests__/rate.test.tsx b/src/rate/__tests__/rate.test.tsx
index 6b6d79581f..8c0fff8124 100644
--- a/src/rate/__tests__/rate.test.tsx
+++ b/src/rate/__tests__/rate.test.tsx
@@ -10,14 +10,14 @@ describe('Rate 组件测试', () => {
test('create', async () => {
const { container } = render(
);
expect(container.firstChild.classList.contains('t-rate')).toBeTruthy();
- expect(document.querySelectorAll('.t-rate__wrapper')).toHaveLength(5);
+ expect(document.querySelectorAll('.t-rate__item')).toHaveLength(5);
expect(container).toMatchSnapshot();
});
// 点击测试
test('onChange', async () => {
const clickFn = jest.fn();
render(
);
- fireEvent.click(document.querySelector('.t-rate__wrapper'));
+ fireEvent.click(document.querySelector('.t-rate__item'));
expect(clickFn).toBeCalledTimes(1);
expect(clickFn).toBeCalledWith(1);
});
@@ -25,13 +25,13 @@ describe('Rate 组件测试', () => {
test('disable', async () => {
const clickFn = jest.fn();
render(
);
- fireEvent.click(document.querySelector('.t-rate__wrapper'));
+ fireEvent.click(document.querySelector('.t-rate__item'));
expect(clickFn).toBeCalledTimes(0);
});
// 数量测试
test('count', async () => {
const { container } = render(
);
- expect(document.querySelectorAll('.t-rate__wrapper')).toHaveLength(10);
+ expect(document.querySelectorAll('.t-rate__item')).toHaveLength(10);
expect(container).toMatchSnapshot();
});
});
diff --git a/src/rate/_example/base.jsx b/src/rate/_example/base.jsx
index 7e790676c4..704ca8e464 100644
--- a/src/rate/_example/base.jsx
+++ b/src/rate/_example/base.jsx
@@ -2,5 +2,5 @@ import React from 'react';
import { Rate } from 'tdesign-react';
export default function BasicRate() {
- return
;
+ return
;
}
diff --git a/src/rate/_example/mulit.jsx b/src/rate/_example/custom.jsx
similarity index 100%
rename from src/rate/_example/mulit.jsx
rename to src/rate/_example/custom.jsx
diff --git a/src/rate/_example/size.jsx b/src/rate/_example/size.jsx
index 6138f29ad5..c1a8fb4744 100644
--- a/src/rate/_example/size.jsx
+++ b/src/rate/_example/size.jsx
@@ -3,10 +3,12 @@ import { Space, Rate } from 'tdesign-react';
export default function BasicRate() {
return (
-
+
+ 16px
+
+ 24px
-
);
}
diff --git a/src/rate/_example/status.jsx b/src/rate/_example/status.jsx
index 9d4268dfd2..9fe4026f49 100644
--- a/src/rate/_example/status.jsx
+++ b/src/rate/_example/status.jsx
@@ -4,9 +4,14 @@ import { Space, Rate } from 'tdesign-react';
export default function BasicRate() {
return (
+ 未评分状态
+
+ 满分状态
-
+
+ 半星状态
+
);
}
diff --git a/src/rate/_example/texts.jsx b/src/rate/_example/texts.jsx
index d6f725cd13..d9fb97f590 100644
--- a/src/rate/_example/texts.jsx
+++ b/src/rate/_example/texts.jsx
@@ -2,5 +2,5 @@ import React from 'react';
import { Rate } from 'tdesign-react';
export default function BasicRate() {
- return ;
+ return ;
}
diff --git a/src/rate/defaultProps.ts b/src/rate/defaultProps.ts
index 28aead7d22..20c06610bb 100644
--- a/src/rate/defaultProps.ts
+++ b/src/rate/defaultProps.ts
@@ -8,9 +8,9 @@ export const rateDefaultProps: TdRateProps = {
defaultValue: 0,
allowHalf: false,
color: '#ED7B2F',
- size: '20',
+ size: '24px',
count: 5,
- gap: 6,
+ gap: 4,
showText: false,
texts: ['极差', '失望', '一般', '满意', '惊喜'],
};
diff --git a/test/ssr/__snapshots__/ssr.test.js.snap b/test/ssr/__snapshots__/ssr.test.js.snap
index 820ea90a50..f09f05ada1 100644
--- a/test/ssr/__snapshots__/ssr.test.js.snap
+++ b/test/ssr/__snapshots__/ssr.test.js.snap
@@ -618,6 +618,16 @@ exports[`ssr snapshot test renders ./src/range-input/_example/size.jsx correctly
exports[`ssr snapshot test renders ./src/range-input/_example/status.jsx correctly 1`] = `""`;
+exports[`ssr snapshot test renders ./src/rate/_example/base.jsx correctly 1`] = `""`;
+
+exports[`ssr snapshot test renders ./src/rate/_example/custom.jsx correctly 1`] = `""`;
+
+exports[`ssr snapshot test renders ./src/rate/_example/size.jsx correctly 1`] = `""`;
+
+exports[`ssr snapshot test renders ./src/rate/_example/status.jsx correctly 1`] = `""`;
+
+exports[`ssr snapshot test renders ./src/rate/_example/texts.jsx correctly 1`] = `""`;
+
exports[`ssr snapshot test renders ./src/select/_example/base.jsx correctly 1`] = `""`;
exports[`ssr snapshot test renders ./src/select/_example/collapsed.jsx correctly 1`] = `""`;