From 51dc0209a6bcf3854debc20a1747627011b4c3ae Mon Sep 17 00:00:00 2001 From: petemill Date: Sat, 13 Oct 2018 23:05:04 -0700 Subject: [PATCH] only handle Button onClick once Fix https://github.com/brave/brave-ui/issues/197 --- src/components/buttonsIndicators/button/index.tsx | 11 +++++++---- .../modalBackupRestore/__snapshots__/spec.tsx.snap | 4 ---- .../rewards/welcomePage/__snapshots__/spec.tsx.snap | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/buttonsIndicators/button/index.tsx b/src/components/buttonsIndicators/button/index.tsx index ad1a6470a..52fec6455 100644 --- a/src/components/buttonsIndicators/button/index.tsx +++ b/src/components/buttonsIndicators/button/index.tsx @@ -54,12 +54,15 @@ export default class ThemedButton extends React.PureComponent { } render () { - const { className, ...deepProps } = this.props - const { icon, text } = this.props + // separate DOM-related props out of props we want to pass to all children + const { className, onClick, ...deepProps } = this.props + const { icon, text } = deepProps + if (!onClick) { + console.warn('Button component not provided an onClick handler as a prop') + } let ButtonComponent = this.getButtonComponent() - return ( - + { text ? diff --git a/src/features/rewards/modalBackupRestore/__snapshots__/spec.tsx.snap b/src/features/rewards/modalBackupRestore/__snapshots__/spec.tsx.snap index 3ce475a5d..7bc385575 100644 --- a/src/features/rewards/modalBackupRestore/__snapshots__/spec.tsx.snap +++ b/src/features/rewards/modalBackupRestore/__snapshots__/spec.tsx.snap @@ -396,7 +396,6 @@ exports[`ModalBackupRestore tests basic tests matches the snapshot 1`] = ` >
@@ -411,7 +410,6 @@ exports[`ModalBackupRestore tests basic tests matches the snapshot 1`] = ` >
@@ -426,7 +424,6 @@ exports[`ModalBackupRestore tests basic tests matches the snapshot 1`] = ` >
@@ -445,7 +442,6 @@ exports[`ModalBackupRestore tests basic tests matches the snapshot 1`] = ` >
diff --git a/src/features/rewards/welcomePage/__snapshots__/spec.tsx.snap b/src/features/rewards/welcomePage/__snapshots__/spec.tsx.snap index e988fda7d..28292b884 100644 --- a/src/features/rewards/welcomePage/__snapshots__/spec.tsx.snap +++ b/src/features/rewards/welcomePage/__snapshots__/spec.tsx.snap @@ -528,7 +528,6 @@ exports[`WelcomePage tests basic tests matches the snapshot 1`] = `
@@ -862,7 +861,6 @@ exports[`WelcomePage tests basic tests matches the snapshot 1`] = ` >