Skip to content

Commit bcc6912

Browse files
authored
Revert "[Form] Default to use POST as the method (#2066)" (#2117)
This reverts commit e2b7ece.
1 parent 60c8727 commit bcc6912

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

UNRELEASED.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f
1010

1111
### Enhancements
1212

13-
- Changed `Form` to default the `method` to `post` in order to prevent accidental leaking of form details ([#2066](https://github.com/Shopify/polaris-react/pull/2066))
1413
- Added support for boolean type on Choice error prop ([#2085](https://github.com/shopify/polaris-react/pull/2085))
1514

1615
### Documentation

src/components/Form/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default class Form extends React.PureComponent<Props> {
4646
children,
4747
encType,
4848
implicitSubmit = true,
49-
method = 'post',
49+
method,
5050
name,
5151
noValidate,
5252
target,

src/components/Form/tests/Form.test.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('<Form />', () => {
1818
const wrapper = mountWithAppProvider(
1919
<Form acceptCharset={acceptCharset} onSubmit={noop} />,
2020
);
21-
expect(wrapper.find('form').prop('acceptCharset')).toBe(acceptCharset);
21+
expect(wrapper.prop('acceptCharset')).toBe(acceptCharset);
2222
});
2323
});
2424

@@ -27,16 +27,16 @@ describe('<Form />', () => {
2727
const wrapper = mountWithAppProvider(
2828
<Form action={action} onSubmit={noop} />,
2929
);
30-
expect(wrapper.find('form').prop('action')).toBe(action);
30+
expect(wrapper.prop('action')).toBe(action);
3131
});
3232
});
3333

3434
describe('autoComplete', () => {
35-
it('sets the autocomplete attribute to "off" when provided as false', () => {
35+
it('sets the autocomplete attribute when provided', () => {
3636
const wrapper = mountWithAppProvider(
3737
<Form autoComplete={false} onSubmit={noop} />,
3838
);
39-
expect(wrapper.find('form').prop('autoComplete')).toBe('off');
39+
expect(wrapper.prop('autoComplete')).toBe(false);
4040
});
4141
});
4242

@@ -45,7 +45,7 @@ describe('<Form />', () => {
4545
const wrapper = mountWithAppProvider(
4646
<Form encType={encType} onSubmit={noop} />,
4747
);
48-
expect(wrapper.find('form').prop('encType')).toBe(encType);
48+
expect(wrapper.prop('encType')).toBe(encType);
4949
});
5050
});
5151

@@ -68,12 +68,7 @@ describe('<Form />', () => {
6868
const wrapper = mountWithAppProvider(
6969
<Form method={method} onSubmit={noop} />,
7070
);
71-
expect(wrapper.find('form').prop('method')).toBe(method);
72-
});
73-
74-
it('defaults to post when no method is set', () => {
75-
const wrapper = mountWithAppProvider(<Form onSubmit={noop} />);
76-
expect(wrapper.find('form').prop('method')).toBe('post');
71+
expect(wrapper.prop('method')).toBe(method);
7772
});
7873
});
7974

@@ -82,7 +77,7 @@ describe('<Form />', () => {
8277
const wrapper = mountWithAppProvider(
8378
<Form name={name} onSubmit={noop} />,
8479
);
85-
expect(wrapper.find('form').prop('name')).toBe(name);
80+
expect(wrapper.prop('name')).toBe(name);
8681
});
8782
});
8883

@@ -91,7 +86,7 @@ describe('<Form />', () => {
9186
const wrapper = mountWithAppProvider(
9287
<Form noValidate={noValidate} onSubmit={noop} />,
9388
);
94-
expect(wrapper.find('form').prop('noValidate')).toBe(noValidate);
89+
expect(wrapper.prop('noValidate')).toBe(noValidate);
9590
});
9691
});
9792

@@ -155,7 +150,7 @@ describe('<Form />', () => {
155150
const wrapper = mountWithAppProvider(
156151
<Form target={target} onSubmit={noop} />,
157152
);
158-
expect(wrapper.find('form').prop('target')).toBe(target);
153+
expect(wrapper.prop('target')).toBe(target);
159154
});
160155
});
161156
});

0 commit comments

Comments
 (0)