diff --git a/javascripts/src/components/common/ProgressableButton.spec.tsx b/javascripts/src/components/common/ProgressableButton.spec.tsx index e2b651e3..031a21fd 100644 --- a/javascripts/src/components/common/ProgressableButton.spec.tsx +++ b/javascripts/src/components/common/ProgressableButton.spec.tsx @@ -25,6 +25,17 @@ describe('ProgressableButton', () => { expect(toJson(output)).toMatchSnapshot() }) + test('Title is kept on progress if no titleOnProgress is set', () => { + let output = mount( + console.log('alert!')} + title={"nothing"} + data-label="button" + inProgress={true} + + />) + expect(toJson(output)).toMatchSnapshot() + }) + test('Progress means we change the title, disable and do turn on spinner', () => { let output = mount( console.log('alert!')} diff --git a/javascripts/src/components/common/ProgressableButton.tsx b/javascripts/src/components/common/ProgressableButton.tsx index 979308fd..80a940ed 100644 --- a/javascripts/src/components/common/ProgressableButton.tsx +++ b/javascripts/src/components/common/ProgressableButton.tsx @@ -24,7 +24,7 @@ class ProgressableButton extends React.Component { } if (this.props.inProgress){ - ourData.title = this.props.titleOnProgress + ourData.title = this.props.titleOnProgress || this.props.title ourData.disabled = ourData.disabled || this.props.disableOnProgress ourData.prefix = } diff --git a/javascripts/src/components/common/__snapshots__/ProgressableButton.spec.tsx.snap b/javascripts/src/components/common/__snapshots__/ProgressableButton.spec.tsx.snap index a99179bf..e797232f 100644 --- a/javascripts/src/components/common/__snapshots__/ProgressableButton.spec.tsx.snap +++ b/javascripts/src/components/common/__snapshots__/ProgressableButton.spec.tsx.snap @@ -110,3 +110,25 @@ exports[`ProgressableButton Progress means we change the title, dont disable and `; + +exports[`ProgressableButton Title is kept on progress if no titleOnProgress is set 1`] = ` + + + +`;