Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck committed May 28, 2021
1 parent 4df0bca commit a093b08
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/__tests__/field/__snapshots__/email_pane.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ exports[`EmailPane renders correctly 1`] = `
<div
data-__type="email_input"
data-autoComplete={false}
data-disabled={false}
data-invalidHint="invalidErrorHint"
data-isValid={false}
data-lockId={1}
Expand All @@ -28,6 +29,7 @@ exports[`EmailPane sets \`blankErrorHint\` when username is empty 1`] = `
<div
data-__type="email_input"
data-autoComplete={false}
data-disabled={false}
data-invalidHint="blankErrorHint"
data-isValid={false}
data-lockId={1}
Expand All @@ -41,6 +43,7 @@ exports[`EmailPane sets autoComplete to true when \`allowAutocomplete\` is true
<div
data-__type="email_input"
data-autoComplete={true}
data-disabled={false}
data-invalidHint="invalidErrorHint"
data-isValid={false}
data-lockId={1}
Expand All @@ -54,6 +57,7 @@ exports[`EmailPane sets isValid as true when \`isFieldVisiblyInvalid\` is false
<div
data-__type="email_input"
data-autoComplete={false}
data-disabled={false}
data-invalidHint="invalidErrorHint"
data-isValid={true}
data-lockId={1}
Expand Down
5 changes: 5 additions & 0 deletions src/__tests__/field/__snapshots__/username_pane.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports[`UsernamePane renders correctly 1`] = `
<div
data-__type="username_input"
data-autoComplete={false}
data-disabled={false}
data-invalidHint="invalidErrorHint"
data-isValid={false}
data-onChange={[Function]}
Expand All @@ -29,6 +30,7 @@ exports[`UsernamePane sets \`blankErrorHint\` when username is empty 1`] = `
<div
data-__type="username_input"
data-autoComplete={false}
data-disabled={false}
data-invalidHint="blankErrorHint"
data-isValid={false}
data-onChange={[Function]}
Expand All @@ -41,6 +43,7 @@ exports[`UsernamePane sets \`usernameFormatErrorHint\` when usernameLooksLikeEma
<div
data-__type="username_input"
data-autoComplete={false}
data-disabled={false}
data-invalidHint="usernameFormatErrorHint,min,max"
data-isValid={false}
data-onChange={[Function]}
Expand All @@ -53,6 +56,7 @@ exports[`UsernamePane sets autoComplete to true when \`allowAutocomplete\` is tr
<div
data-__type="username_input"
data-autoComplete={true}
data-disabled={false}
data-invalidHint="invalidErrorHint"
data-isValid={false}
data-onChange={[Function]}
Expand All @@ -65,6 +69,7 @@ exports[`UsernamePane sets isValid as true when \`isFieldVisiblyInvalid\` is fal
<div
data-__type="username_input"
data-autoComplete={false}
data-disabled={false}
data-invalidHint="invalidErrorHint"
data-isValid={true}
data-onChange={[Function]}
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/field/email_pane.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('EmailPane', () => {

jest.mock('core/index', () => ({
id: () => 1,
submitting: () => false,
ui: {
avatar: () => false,
allowAutocomplete: () => false
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/field/username_pane.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('UsernamePane', () => {

jest.mock('core/index', () => ({
id: () => 1,
submitting: () => false,
ui: {
avatar: () => false,
allowAutocomplete: () => false
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/ui/box/container.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ describe('Container', () => {
expect(mock.calls.length).toBe(0);
});

it('should submit the form when the submit button is not disabled', () => {
const c = getContainer({ disableSubmitButton: false });
it('should submit the form when the form is not yet submitting', () => {
const c = getContainer({ isSubmitting: false });
const connectionResolverMock = jest.fn();
require('core/index').connectionResolver = () => connectionResolverMock;

c.handleSubmit(mockEvent);
expect(connectionResolverMock).toHaveBeenCalled();
});

it('should not submit the form when the submit button is disabled', () => {
const c = getContainer({ disableSubmitButton: true });
it('should not submit the form when the form is already submitting', () => {
const c = getContainer({ isSubmitting: true });
const connectionResolverMock = jest.fn();
require('core/index').connectionResolver = () => connectionResolverMock;

Expand Down

0 comments on commit a093b08

Please sign in to comment.