From dda0c65fec68958ba10d948fc636709c4f8078a4 Mon Sep 17 00:00:00 2001 From: RickCole Date: Wed, 20 Apr 2022 15:25:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8C=89=E9=92=AEdisa?= =?UTF-8?q?bledTip=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98=20(#4086)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复按钮disabledTip失效问题 * 补一下注释 e.persist() --- __tests__/renderers/Action.test.tsx | 45 +++++ .../__snapshots__/Action.test.tsx.snap | 184 ++++++++++++++++++ scss/_properties.scss | 1 + scss/components/_button.scss | 76 ++++---- src/renderers/Action.tsx | 2 +- src/utils/handleAction.ts | 2 +- 6 files changed, 269 insertions(+), 41 deletions(-) diff --git a/__tests__/renderers/Action.test.tsx b/__tests__/renderers/Action.test.tsx index 7d81f90ea..d1ac9bfc5 100644 --- a/__tests__/renderers/Action.test.tsx +++ b/__tests__/renderers/Action.test.tsx @@ -14,6 +14,51 @@ import '../../src/themes/default'; afterEach(cleanup); +test('Renderers:Action all levels', () => { + const levels = [ + 'link', + 'primary', + 'secondary', + 'info', + 'success', + 'warning', + 'danger', + 'light', + 'dark', + 'default' + ]; + + const {container} = render( + amisRender( + { + type: 'page', + body: [ + levels.map(item => ({ + type: 'button', + level: item, + label: `按钮 ${item}` + })), + + { + type: 'divider' + }, + + levels.map(item => ({ + type: 'button', + level: item, + disabled: true, + label: `按钮${item}` + })) + ] + }, + {}, + makeEnv({}) + ) + ); + + expect(container).toMatchSnapshot(); +}); + test('Renderers:Action MenuItem changes class when actived & disabled', () => { const component = renderer.create( diff --git a/__tests__/renderers/__snapshots__/Action.test.tsx.snap b/__tests__/renderers/__snapshots__/Action.test.tsx.snap index 159c4006f..a330f85e1 100644 --- a/__tests__/renderers/__snapshots__/Action.test.tsx.snap +++ b/__tests__/renderers/__snapshots__/Action.test.tsx.snap @@ -83,6 +83,190 @@ exports[`Renderers:Action MenuItem display icon 2`] = ` `; +exports[`Renderers:Action all levels 1`] = ` +
+
+
+
+
+ + + + + + + + + + +
+ +
+ + 按钮primary + +
+
+ + 按钮secondary + +
+
+ + 按钮info + +
+
+ + 按钮success + +
+
+ + 按钮warning + +
+
+ + 按钮danger + +
+
+ + 按钮light + +
+
+ + 按钮dark + +
+
+ + 按钮default + +
+
+
+
+
+
+`; + exports[`Renderers:Action custom activeClass 1`] = `