From 5472c050d55f8ff4ed5e397d03cc83ce5e4cb28f Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Tue, 19 Jul 2022 15:39:27 -0400 Subject: [PATCH 1/3] Revert "[core] fix(Button, AnchorButton): preserve non-null disabled prop value (#5360)" This reverts commit b6ea71e11b284d29ef6a05f01121d563f5903619. --- packages/core/src/components/button/abstractButton.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/components/button/abstractButton.tsx b/packages/core/src/components/button/abstractButton.tsx index 2b9220d37f..331671b4be 100644 --- a/packages/core/src/components/button/abstractButton.tsx +++ b/packages/core/src/components/button/abstractButton.tsx @@ -120,8 +120,8 @@ export abstract class AbstractButton Date: Tue, 19 Jul 2022 15:42:47 -0400 Subject: [PATCH 2/3] [core] docs: button loading prop overrides disabled --- .../src/components/button/abstractButton.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/core/src/components/button/abstractButton.tsx b/packages/core/src/components/button/abstractButton.tsx index 331671b4be..a6e5948537 100644 --- a/packages/core/src/components/button/abstractButton.tsx +++ b/packages/core/src/components/button/abstractButton.tsx @@ -65,8 +65,9 @@ export interface IButtonProps Date: Tue, 19 Jul 2022 16:26:16 -0400 Subject: [PATCH 3/3] add unit test to prevent future regressions --- packages/core/test/buttons/buttonTests.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/core/test/buttons/buttonTests.tsx b/packages/core/test/buttons/buttonTests.tsx index 4d2a808ac8..581e72099c 100644 --- a/packages/core/test/buttons/buttonTests.tsx +++ b/packages/core/test/buttons/buttonTests.tsx @@ -79,6 +79,14 @@ function buttonTestSuite(component: React.ComponentClass, tagName: string) assert.isTrue(wrapper.hasClass(Classes.DISABLED)); }); + // This tests some subtle (potentialy unexpected) behavior, but it was an API decision we + // made a long time ago which we rely on and should not break. + // See https://github.com/palantir/blueprint/issues/3819#issuecomment-1189478596 + it("button is disabled when the loading prop is true, even if disabled={false}", () => { + const wrapper = button({ disabled: false, loading: true }); + assert.isTrue(wrapper.hasClass(Classes.DISABLED)); + }); + it("clicking button triggers onClick prop", () => { const onClick = spy(); button({ onClick }).simulate("click");