Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
Fix Bug 1515663 - Block FxA snippet on form submit (#4635)
Browse files Browse the repository at this point in the history
  • Loading branch information
piatra committed Jan 7, 2019
1 parent 06fbd77 commit c56b04a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Expand Up @@ -38,6 +38,7 @@ export class SubmitFormSnippet extends React.PureComponent {
this.props.sendUserActionTelemetry({event: "CLICK_BUTTON", value: "conversion-subscribe-activation", id: "NEWTAB_FOOTER_BAR_CONTENT"});

if (this.props.form_method.toUpperCase() === "GET") {
this.props.onBlock({preventDismiss: true});
this.refs.form.submit();
return;
}
Expand Down
9 changes: 9 additions & 0 deletions test/unit/asrouter/templates/SubmitFormSnippet.test.jsx
Expand Up @@ -249,5 +249,14 @@ describe("SubmitFormSnippet", () => {

assert.notCalled(window.fetch);
});
it("should block the snippet when form_method is GET", () => {
wrapper.setProps({form_method: "GET"});
wrapper.setState({expanded: true});

wrapper.instance().handleSubmit({preventDefault: sandbox.stub()});

assert.calledOnce(onBlockStub);
assert.calledWithExactly(onBlockStub, {preventDismiss: true});
});
});
});

0 comments on commit c56b04a

Please sign in to comment.