feat(Steps): add icon-prefix prop (#8631)

This commit is contained in:
neverland
2021-04-28 17:21:06 +08:00
committed by GitHub
parent e2286b0426
commit 2055e3a1ee
6 changed files with 55 additions and 8 deletions
@@ -69,7 +69,7 @@ exports[`should render finish icon slot correctly 1`] = `
A
</div>
<div class="van-step__circle-container">
Custim Fiinsh Icon
Custom Finish Icon
</div>
<div class="van-step__line">
</div>
@@ -84,7 +84,7 @@ exports[`should render icon slot correctly 1`] = `
B
</div>
<div class="van-step__circle-container">
Custim Active Icon
Custom Active Icon
</div>
<div class="van-step__line">
</div>
@@ -94,7 +94,7 @@ exports[`should render icon slot correctly 1`] = `
A
</div>
<div class="van-step__circle-container">
Custim Inactive Icon
Custom Inactive Icon
</div>
<div class="van-step__line">
</div>
@@ -102,3 +102,17 @@ exports[`should render icon slot correctly 1`] = `
</div>
</div>
`;
exports[`should render icon-prefix correctly 1`] = `
<div class="van-hairline van-step van-step--horizontal van-step--process">
<div class="van-step__title van-step__title--active">
B
</div>
<div class="van-step__circle-container">
<i class="van-badge__wrapper custom-icon custom-icon-checked van-step__icon van-step__icon--active">
</i>
</div>
<div class="van-step__line">
</div>
</div>
`;
+19 -3
View File
@@ -7,8 +7,8 @@ test('should render icon slot correctly', () => {
render() {
return (
<Steps active={0}>
<Step v-slots={{ 'active-icon': () => `Custim Active Icon` }}>B</Step>
<Step v-slots={{ 'inactive-icon': () => `Custim Inactive Icon` }}>
<Step v-slots={{ 'active-icon': () => `Custom Active Icon` }}>B</Step>
<Step v-slots={{ 'inactive-icon': () => `Custom Inactive Icon` }}>
A
</Step>
</Steps>
@@ -96,7 +96,7 @@ test('should render finish icon slot correctly', () => {
render() {
return (
<Steps active={1}>
<Step v-slots={{ 'finish-icon': () => `Custim Fiinsh Icon` }}>A</Step>
<Step v-slots={{ 'finish-icon': () => `Custom Finish Icon` }}>A</Step>
<Step>B</Step>
</Steps>
);
@@ -106,3 +106,19 @@ test('should render finish icon slot correctly', () => {
const firstStep = wrapper.find('.van-step');
expect(firstStep.html()).toMatchSnapshot();
});
test('should render icon-prefix correctly', () => {
const wrapper = mount({
render() {
return (
<Steps active={1} iconPrefix="custom-icon">
<Step>A</Step>
<Step>B</Step>
</Steps>
);
},
});
const steps = wrapper.findAll('.van-step');
expect(steps[1].html()).toMatchSnapshot();
});