Skip to content

Commit

Permalink
fix(deps,tests): update dependencies, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdauner committed Mar 6, 2020
1 parent 02ee359 commit fd16275
Show file tree
Hide file tree
Showing 6 changed files with 2,231 additions and 1,806 deletions.
9 changes: 0 additions & 9 deletions .dependabot/config.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
'svelte3/ignore-styles': attributes =>
attributes.lang && attributes.lang.includes('scss'),
},
rules: {
'jest/no-test-callback': 0
},
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
Expand Down
82 changes: 41 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,51 @@
"module": "dist/index.min.mjs",
"main": "dist/index.min.js",
"devDependencies": {
"@babel/core": "7.7.5",
"@babel/plugin-syntax-dynamic-import": "7.7.4",
"@babel/plugin-transform-runtime": "7.7.6",
"@babel/preset-env": "7.7.6",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@testing-library/jest-dom": "4.2.4",
"@testing-library/svelte": "1.11.0",
"@types/jest": "24.0.23",
"autoprefixer": "9.7.3",
"babel-jest": "24.9.0",
"cz-conventional-changelog": "3.0.2",
"eslint": "6.8.0",
"eslint-config-prettier": "6.7.0",
"eslint-plugin-jest": "22.20.0",
"eslint-plugin-svelte3": "2.7.3",
"husky": "3.1.0",
"jest": "24.9.0",
"jest-transform-svelte": "2.1.0",
"lint-staged": "9.5.0",
"node-sass": "^4.12.0",
"npm-run-all": "4.1.5",
"postcss": "7.0.27",
"postcss-load-config": "^2.1.0",
"prettier": "1.18.2",
"prettier-plugin-svelte": "^0.7.0",
"rollup": "1.26.5",
"rollup-plugin-babel": "4.3.3",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-livereload": "1.0.4",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-svelte": "5.1.1",
"rollup-plugin-terser": "5.1.3",
"semantic-release": "^15.13.24",
"sirv-cli": "0.4.5",
"svelte": "3.12.1",
"svelte-preprocess": "3.3.1",
"yup": "0.27.0"
"@babel/core": "~7.8.7",
"@babel/plugin-syntax-dynamic-import": "~7.8.3",
"@babel/plugin-transform-runtime": "~7.8.3",
"@babel/preset-env": "~7.8.7",
"@commitlint/cli": "~8.3.5",
"@commitlint/config-conventional": "~8.3.4",
"@testing-library/jest-dom": "~5.1.1",
"@testing-library/svelte": "~1.11.0",
"@types/jest": "~25.1.3",
"autoprefixer": "~9.7.4",
"babel-jest": "~25.1.0",
"cz-conventional-changelog": "~3.1.0",
"eslint": "~6.8.0",
"eslint-config-prettier": "~6.10.00",
"eslint-plugin-jest": "~23.8.1",
"eslint-plugin-svelte3": "~2.7.3",
"husky": "~4.2.3",
"jest": "~25.1.0",
"jest-transform-svelte": "~2.1.1",
"lint-staged": "~10.0.8",
"node-sass": "~4.13.1",
"npm-run-all": "~4.1.5",
"postcss": "~7.0.27",
"postcss-load-config": "~2.1.0",
"prettier": "~1.19.1",
"prettier-plugin-svelte": "~0.7.0",
"rollup": "~1.32.0",
"rollup-plugin-babel": "~4.3.3",
"rollup-plugin-commonjs": "~10.1.0",
"rollup-plugin-livereload": "~1.0.4",
"rollup-plugin-node-resolve": "~5.2.0",
"rollup-plugin-svelte": "~5.1.1",
"rollup-plugin-terser": "~5.2.0",
"semantic-release": "~17.0.4",
"sirv-cli": "~0.4.5",
"svelte": "~3.19.2",
"svelte-preprocess": "~3.4.0",
"yup": "~0.28.2"
},
"peerDependencies": {
"yup": "0.27.0"
"yup": "~0.28.2"
},
"dependencies": {
"lodash-es": "^4.17.15",
"svelte-writable-derived": "^2.0.1"
"lodash-es": "~4.17.15",
"svelte-writable-derived": "~2.0.1"
},
"scripts": {
"prettier": "prettier --check '**/*.{svelte, html, css, scss, stylus, js, ts, json, yml, md}' --plugin-search-dir=.",
Expand Down
43 changes: 23 additions & 20 deletions tests/Form/Form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ describe('Form', () => {
});
const signInButton = getByText('Sign in');

expect(component.form.$$.ctx.$isSubmitting).toBe(false);
expect(component.form.$capture_state().$isSubmitting).toBe(false);
expect(signInButton).not.toHaveAttribute('disabled');

await fireEvent.click(signInButton);
await wait();
expect(component.onSubmit).toHaveBeenCalledTimes(1);
expect(signInButton).toHaveAttribute('disabled');
expect(component.form.$$.ctx.$isSubmitting).toBe(true);
expect(component.form.$capture_state().$isSubmitting).toBe(true);
});

it('onSubmit event returns values, resetForm, setSubmitting', async done => {
Expand All @@ -32,17 +32,20 @@ describe('Form', () => {
({ detail: { values, setSubmitting, resetForm } }) => {
expect(values).toMatchSnapshot();

expect(component.form.$$.ctx.$isSubmitting).toBeTruthy();
expect(component.form.$capture_state().$isSubmitting).toBeTruthy();

setSubmitting(false);
expect(component.form.$$.ctx.$isSubmitting).toBeFalsy();
let formState = component.form.$capture_state();
expect(formState.$isSubmitting).toBeFalsy();
expect(formState.$values).toMatchSnapshot();
expect(formState.$errors).toMatchSnapshot();
expect(formState.$touched).toMatchSnapshot();

expect(component.form.$$.ctx.$values).toMatchSnapshot();
expect(component.form.$$.ctx.$errors).toMatchSnapshot();
expect(component.form.$$.ctx.$touched).toMatchSnapshot();
resetForm();
expect(component.form.$$.ctx.$values).toMatchSnapshot();
expect(component.form.$$.ctx.$errors).toMatchSnapshot();
expect(component.form.$$.ctx.$touched).toMatchSnapshot();
formState = component.form.$capture_state();
expect(formState.$values).toMatchSnapshot();
expect(formState.$errors).toMatchSnapshot();
expect(formState.$touched).toMatchSnapshot();

done();
}
Expand All @@ -68,7 +71,7 @@ describe('Form', () => {

const signInButton = getByText('Sign in');

expect(component.form.$$.ctx.$isSubmitting).toBe(false);
expect(component.form.$capture_state().$isSubmitting).toBe(false);
expect(signInButton).not.toHaveAttribute('disabled');

await fireEvent.click(signInButton);
Expand All @@ -81,11 +84,11 @@ describe('Form', () => {
user: { email: 'initial@value.com' },
},
onSubmit: jest.fn(({ detail: { resetForm } }) => {
expect(component.form.$$.ctx.$values.user.email).toEqual(
expect(component.form.$capture_state().$values.user.email).toEqual(
'test@user.com'
);
resetForm();
expect(component.form.$$.ctx.$values.user.email).toEqual(
expect(component.form.$capture_state().$values.user.email).toEqual(
'initial@value.com'
);

Expand All @@ -110,13 +113,13 @@ describe('Form', () => {
user: { email: 'initial@value.com' },
},
onSubmit: jest.fn(({ detail: { resetForm } }) => {
expect(component.form.$$.ctx.$values.user.email).toEqual(
expect(component.form.$capture_state().$values.user.email).toEqual(
'test@user.com'
);
resetForm({
user: { email: 'after@reset.com' },
});
expect(component.form.$$.ctx.$values.user.email).toEqual(
expect(component.form.$capture_state().$values.user.email).toEqual(
'after@reset.com'
);

Expand Down Expand Up @@ -160,7 +163,7 @@ describe('Form', () => {
await wait(() => {
expect(getByText('user.email must be a valid email')).toBeInTheDocument();
});
expect(component.form.$$.ctx.$errors).toEqual({
expect(component.form.$capture_state().$errors).toEqual({
user: { email: 'user.email must be a valid email' },
});

Expand All @@ -170,12 +173,12 @@ describe('Form', () => {
it('registers fields and sets default values', async () => {
const { component } = await render(App);

expect(component.form.$$.ctx.$values).toMatchObject({
expect(component.form.$capture_state().$values).toMatchObject({
user: { email: '' },
language: '',
os: [],
});
expect(component.form.$$.ctx.$touched).toMatchObject({
expect(component.form.$capture_state().$touched).toMatchObject({
user: { email: false },
language: false,
os: false,
Expand All @@ -184,15 +187,15 @@ describe('Form', () => {

it('isValid is undefined initially', async () => {
const { component } = await render(App);
expect(component.form.$$.ctx.isValid).toBe(undefined);
expect(component.form.$capture_state().isValid).toBe(undefined);
});

it('sets initial values', async () => {
const { component } = await render(App, {
props: { initialValues: { user: { email: 'test@user.com' } } },
});

expect(component.form.$$.ctx.$values).toMatchObject({
expect(component.form.$capture_state().$values).toMatchObject({
user: { email: 'test@user.com' },
language: '',
os: [],
Expand Down
10 changes: 5 additions & 5 deletions tests/Input/Input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Input', () => {
target: { value: 'test@user.com' },
});

expect(component.form.$$.ctx.$values).toMatchObject({
expect(component.form.$capture_state().$values).toMatchObject({
email: 'test@user.com',
});
});
Expand All @@ -43,7 +43,7 @@ describe('Input', () => {
});
await wait();

expect(component.form.$$.ctx.$errors).toEqual({
expect(component.form.$capture_state().$errors).toEqual({
email: 'email must be a valid email',
});
});
Expand All @@ -63,7 +63,7 @@ describe('Input', () => {
});
await wait();

expect(component.form.$$.ctx.$errors).toEqual({});
expect(component.form.$capture_state().$errors).toEqual({});
});

it('validates on blur if validateOnBlur is true', async () => {
Expand All @@ -82,7 +82,7 @@ describe('Input', () => {
await fireEvent.blur(emailInput);
await wait();

expect(component.form.$$.ctx.$errors).toEqual({
expect(component.form.$capture_state().$errors).toEqual({
email: 'email must be a valid email',
});
});
Expand All @@ -102,7 +102,7 @@ describe('Input', () => {
});
await fireEvent.blur(emailInput);
await wait();
expect(component.form.$$.ctx.$errors).toEqual({});
expect(component.form.$capture_state().$errors).toEqual({});
});

it('matches snapshot', async () => {
Expand Down

0 comments on commit fd16275

Please sign in to comment.