From d17e0ae9b81afd8f826bc004e6490500a1a35c81 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 28 Feb 2021 19:50:16 +0800 Subject: [PATCH] feat(Step): add finish-icon slot (#8241) --- src/step/index.tsx | 6 +++++- src/steps/README.md | 9 +++++---- src/steps/README.zh-CN.md | 7 ++++--- src/steps/test/__snapshots__/index.spec.tsx.snap | 13 +++++++++++++ src/steps/test/index.spec.tsx | 16 ++++++++++++++++ 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/step/index.tsx b/src/step/index.tsx index 9c61a91e3..7e12d3a22 100644 --- a/src/step/index.tsx +++ b/src/step/index.tsx @@ -73,7 +73,11 @@ export default createComponent({ ); } - if (getStatus() === 'finish' && finishIcon) { + if (getStatus() === 'finish' && (finishIcon || slots['finish-icon'])) { + if (slots['finish-icon']) { + return slots['finish-icon'](); + } + return ( `; +exports[`should render finish icon slot correctly 1`] = ` +
+
+ A +
+
+ Custim Fiinsh Icon +
+
+
+
+`; + exports[`should render icon slot correctly 1`] = `
diff --git a/src/steps/test/index.spec.tsx b/src/steps/test/index.spec.tsx index e98dc1b7e..3d35f6b53 100644 --- a/src/steps/test/index.spec.tsx +++ b/src/steps/test/index.spec.tsx @@ -90,3 +90,19 @@ test('should change finish icon when using finish-icon prop', () => { expect(firstStep.find('.van-icon-foo').exists()).toBeTruthy(); expect(firstStep.html()).toMatchSnapshot(); }); + +test('should render finish icon slot correctly', () => { + const wrapper = mount({ + render() { + return ( + + `Custim Fiinsh Icon` }}>A + B + + ); + }, + }); + + const firstStep = wrapper.find('.van-step'); + expect(firstStep.html()).toMatchSnapshot(); +});