From 6eeb2639f2c35fa95baa2542650cba404bca1bbf Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 28 Jun 2018 13:51:36 -0500 Subject: [PATCH] Rename attributes from title->buttonText and titleOnProgress->buttonTextOnProgress for ProgressableButton --- .../common/ProgressableButton.spec.tsx | 20 +++---- .../components/common/ProgressableButton.tsx | 10 ++-- .../ProgressableButton.spec.tsx.snap | 54 +++++++++++-------- .../registration_page/NonprofitInfoForm.tsx | 3 +- .../registration_page/RegistrationWizard.tsx | 2 +- .../registration_page/UserInfoForm.tsx | 6 +-- .../registration_page/UserInfoPanel.tsx | 4 +- 7 files changed, 56 insertions(+), 43 deletions(-) diff --git a/javascripts/src/components/common/ProgressableButton.spec.tsx b/javascripts/src/components/common/ProgressableButton.spec.tsx index 031a21fd..c0b20284 100644 --- a/javascripts/src/components/common/ProgressableButton.spec.tsx +++ b/javascripts/src/components/common/ProgressableButton.spec.tsx @@ -8,16 +8,16 @@ import {shallow, mount} from 'enzyme'; describe('ProgressableButton', () => { test('Basic title button works', () => { let output = shallow( - console.log('alert!')} title={"nothing"} data-label="button"/>) + console.log('alert!')} buttonText={"nothing"} data-label="button"/>) expect(toJson(output)).toMatchSnapshot() }) test('Progress means we change the title, dont disable and do turn on spinner', () => { let output = mount( console.log('alert!')} - title={"nothing"} + buttonText={"nothing"} data-label="button" - titleOnProgress={"onProgress"} + buttonTextOnProgress={"onProgress"} inProgress={true} disableOnProgress={false} @@ -28,7 +28,7 @@ describe('ProgressableButton', () => { test('Title is kept on progress if no titleOnProgress is set', () => { let output = mount( console.log('alert!')} - title={"nothing"} + buttonText={"nothing"} data-label="button" inProgress={true} @@ -39,9 +39,9 @@ describe('ProgressableButton', () => { test('Progress means we change the title, disable and do turn on spinner', () => { let output = mount( console.log('alert!')} - title={"nothing"} + buttonText={"nothing"} data-label="button" - titleOnProgress={"onProgress"} + buttonTextOnProgress={"onProgress"} inProgress={true} disableOnProgress={true} @@ -53,9 +53,9 @@ describe('ProgressableButton', () => { test('Disabled manually set overrides whether we disable on progress when in progress', () => { let output = mount( console.log('alert!')} - title={"nothing"} + buttonText={"nothing"} data-label="button" - titleOnProgress={"onProgress"} + buttonTextOnProgress={"onProgress"} inProgress={true} disableOnProgress={false} disabled={true} @@ -68,9 +68,9 @@ describe('ProgressableButton', () => { test('Disabled manually set overrides whether we disable on progress when NOT in progress', () => { let output = mount( console.log('alert!')} - title={"nothing"} + buttonText={"nothing"} data-label="button" - titleOnProgress={"onProgress"} + buttonTextOnProgress={"onProgress"} inProgress={false} disableOnProgress={true} disabled={true} diff --git a/javascripts/src/components/common/ProgressableButton.tsx b/javascripts/src/components/common/ProgressableButton.tsx index b174945b..4f458ead 100644 --- a/javascripts/src/components/common/ProgressableButton.tsx +++ b/javascripts/src/components/common/ProgressableButton.tsx @@ -6,8 +6,8 @@ import {InjectedIntlProps, injectIntl} from 'react-intl'; export interface ProgressableButtonProps { - title:string - titleOnProgress?:string + buttonText:string + buttonTextOnProgress?:string inProgress?:boolean disableOnProgress?:boolean disabled?:boolean @@ -18,18 +18,18 @@ export interface ProgressableButtonProps class ProgressableButton extends React.Component { render() { let ourData: {title: string, disabled: boolean, prefix: JSX.Element|null}= { - title:this.props.title, + title:this.props.buttonText, disabled:this.props.disabled, prefix: null } if (this.props.inProgress){ - ourData.title = this.props.titleOnProgress || this.props.title + ourData.title = this.props.buttonTextOnProgress || this.props.buttonText ourData.disabled = ourData.disabled || this.props.disableOnProgress ourData.prefix = } - let props = _.omit(this.props, ['title', 'disableOnProgress', 'titleOnProgress', 'inProgress']) + let props = _.omit(this.props, ['buttonText', 'disableOnProgress', 'buttonTextOnProgress', 'inProgress']) return @@ -63,12 +66,12 @@ exports[`ProgressableButton Disabled manually set overrides whether we disable o exports[`ProgressableButton Progress means we change the title, disable and do turn on spinner 1`] = ` @@ -88,12 +94,12 @@ exports[`ProgressableButton Progress means we change the title, disable and do t exports[`ProgressableButton Progress means we change the title, dont disable and do turn on spinner 1`] = ` @@ -113,10 +122,10 @@ exports[`ProgressableButton Progress means we change the title, dont disable and exports[`ProgressableButton Title is kept on progress if no titleOnProgress is set 1`] = ` diff --git a/javascripts/src/components/registration_page/NonprofitInfoForm.tsx b/javascripts/src/components/registration_page/NonprofitInfoForm.tsx index 522e4708..8f7ffd89 100644 --- a/javascripts/src/components/registration_page/NonprofitInfoForm.tsx +++ b/javascripts/src/components/registration_page/NonprofitInfoForm.tsx @@ -72,7 +72,8 @@ class NonprofitInfoForm extends React.Component - + } } diff --git a/javascripts/src/components/registration_page/RegistrationWizard.tsx b/javascripts/src/components/registration_page/RegistrationWizard.tsx index bfb185ea..65392b27 100644 --- a/javascripts/src/components/registration_page/RegistrationWizard.tsx +++ b/javascripts/src/components/registration_page/RegistrationWizard.tsx @@ -197,7 +197,7 @@ export class InnerRegistrationWizard extends React.Component + buttonText="registration.wizard.save_and_finish" buttonTextInProgress="registration.wizard.saving"/> } } diff --git a/javascripts/src/components/registration_page/UserInfoForm.tsx b/javascripts/src/components/registration_page/UserInfoForm.tsx index d20a1878..d115e705 100644 --- a/javascripts/src/components/registration_page/UserInfoForm.tsx +++ b/javascripts/src/components/registration_page/UserInfoForm.tsx @@ -39,7 +39,7 @@ export interface UserInfoFormProps { form: Field buttonText:string - inProgressTitle?:string + buttonTextInProgress?:string } @@ -59,9 +59,9 @@ class UserInfoForm extends React.Component ; } diff --git a/javascripts/src/components/registration_page/UserInfoPanel.tsx b/javascripts/src/components/registration_page/UserInfoPanel.tsx index 159c2feb..ea81fc5d 100644 --- a/javascripts/src/components/registration_page/UserInfoPanel.tsx +++ b/javascripts/src/components/registration_page/UserInfoPanel.tsx @@ -10,7 +10,7 @@ import UserInfoForm from "./UserInfoForm"; export interface UserInfoPanelProps extends WizardTabPanelProps { buttonText: string - inProgressTitle?:string + buttonTextInProgress?:string } class UserInfoPanel extends React.Component { @@ -39,7 +39,7 @@ class UserInfoPanel extends React.Component - + ; }