Skip to content

Commit fd16275

Browse files
committed
fix(deps,tests): update dependencies, fix tests
1 parent 02ee359 commit fd16275

File tree

6 files changed

+2231
-1806
lines changed

6 files changed

+2231
-1806
lines changed

.dependabot/config.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ module.exports = {
1616
'svelte3/ignore-styles': attributes =>
1717
attributes.lang && attributes.lang.includes('scss'),
1818
},
19+
rules: {
20+
'jest/no-test-callback': 0
21+
},
1922
parserOptions: {
2023
ecmaVersion: 2019,
2124
sourceType: 'module',

package.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,51 @@
99
"module": "dist/index.min.mjs",
1010
"main": "dist/index.min.js",
1111
"devDependencies": {
12-
"@babel/core": "7.7.5",
13-
"@babel/plugin-syntax-dynamic-import": "7.7.4",
14-
"@babel/plugin-transform-runtime": "7.7.6",
15-
"@babel/preset-env": "7.7.6",
16-
"@commitlint/cli": "^8.2.0",
17-
"@commitlint/config-conventional": "^8.2.0",
18-
"@testing-library/jest-dom": "4.2.4",
19-
"@testing-library/svelte": "1.11.0",
20-
"@types/jest": "24.0.23",
21-
"autoprefixer": "9.7.3",
22-
"babel-jest": "24.9.0",
23-
"cz-conventional-changelog": "3.0.2",
24-
"eslint": "6.8.0",
25-
"eslint-config-prettier": "6.7.0",
26-
"eslint-plugin-jest": "22.20.0",
27-
"eslint-plugin-svelte3": "2.7.3",
28-
"husky": "3.1.0",
29-
"jest": "24.9.0",
30-
"jest-transform-svelte": "2.1.0",
31-
"lint-staged": "9.5.0",
32-
"node-sass": "^4.12.0",
33-
"npm-run-all": "4.1.5",
34-
"postcss": "7.0.27",
35-
"postcss-load-config": "^2.1.0",
36-
"prettier": "1.18.2",
37-
"prettier-plugin-svelte": "^0.7.0",
38-
"rollup": "1.26.5",
39-
"rollup-plugin-babel": "4.3.3",
40-
"rollup-plugin-commonjs": "10.1.0",
41-
"rollup-plugin-livereload": "1.0.4",
42-
"rollup-plugin-node-resolve": "5.2.0",
43-
"rollup-plugin-svelte": "5.1.1",
44-
"rollup-plugin-terser": "5.1.3",
45-
"semantic-release": "^15.13.24",
46-
"sirv-cli": "0.4.5",
47-
"svelte": "3.12.1",
48-
"svelte-preprocess": "3.3.1",
49-
"yup": "0.27.0"
12+
"@babel/core": "~7.8.7",
13+
"@babel/plugin-syntax-dynamic-import": "~7.8.3",
14+
"@babel/plugin-transform-runtime": "~7.8.3",
15+
"@babel/preset-env": "~7.8.7",
16+
"@commitlint/cli": "~8.3.5",
17+
"@commitlint/config-conventional": "~8.3.4",
18+
"@testing-library/jest-dom": "~5.1.1",
19+
"@testing-library/svelte": "~1.11.0",
20+
"@types/jest": "~25.1.3",
21+
"autoprefixer": "~9.7.4",
22+
"babel-jest": "~25.1.0",
23+
"cz-conventional-changelog": "~3.1.0",
24+
"eslint": "~6.8.0",
25+
"eslint-config-prettier": "~6.10.00",
26+
"eslint-plugin-jest": "~23.8.1",
27+
"eslint-plugin-svelte3": "~2.7.3",
28+
"husky": "~4.2.3",
29+
"jest": "~25.1.0",
30+
"jest-transform-svelte": "~2.1.1",
31+
"lint-staged": "~10.0.8",
32+
"node-sass": "~4.13.1",
33+
"npm-run-all": "~4.1.5",
34+
"postcss": "~7.0.27",
35+
"postcss-load-config": "~2.1.0",
36+
"prettier": "~1.19.1",
37+
"prettier-plugin-svelte": "~0.7.0",
38+
"rollup": "~1.32.0",
39+
"rollup-plugin-babel": "~4.3.3",
40+
"rollup-plugin-commonjs": "~10.1.0",
41+
"rollup-plugin-livereload": "~1.0.4",
42+
"rollup-plugin-node-resolve": "~5.2.0",
43+
"rollup-plugin-svelte": "~5.1.1",
44+
"rollup-plugin-terser": "~5.2.0",
45+
"semantic-release": "~17.0.4",
46+
"sirv-cli": "~0.4.5",
47+
"svelte": "~3.19.2",
48+
"svelte-preprocess": "~3.4.0",
49+
"yup": "~0.28.2"
5050
},
5151
"peerDependencies": {
52-
"yup": "0.27.0"
52+
"yup": "~0.28.2"
5353
},
5454
"dependencies": {
55-
"lodash-es": "^4.17.15",
56-
"svelte-writable-derived": "^2.0.1"
55+
"lodash-es": "~4.17.15",
56+
"svelte-writable-derived": "~2.0.1"
5757
},
5858
"scripts": {
5959
"prettier": "prettier --check '**/*.{svelte, html, css, scss, stylus, js, ts, json, yml, md}' --plugin-search-dir=.",

tests/Form/Form.spec.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ describe('Form', () => {
1010
});
1111
const signInButton = getByText('Sign in');
1212

13-
expect(component.form.$$.ctx.$isSubmitting).toBe(false);
13+
expect(component.form.$capture_state().$isSubmitting).toBe(false);
1414
expect(signInButton).not.toHaveAttribute('disabled');
1515

1616
await fireEvent.click(signInButton);
1717
await wait();
1818
expect(component.onSubmit).toHaveBeenCalledTimes(1);
1919
expect(signInButton).toHaveAttribute('disabled');
20-
expect(component.form.$$.ctx.$isSubmitting).toBe(true);
20+
expect(component.form.$capture_state().$isSubmitting).toBe(true);
2121
});
2222

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

35-
expect(component.form.$$.ctx.$isSubmitting).toBeTruthy();
35+
expect(component.form.$capture_state().$isSubmitting).toBeTruthy();
36+
3637
setSubmitting(false);
37-
expect(component.form.$$.ctx.$isSubmitting).toBeFalsy();
38+
let formState = component.form.$capture_state();
39+
expect(formState.$isSubmitting).toBeFalsy();
40+
expect(formState.$values).toMatchSnapshot();
41+
expect(formState.$errors).toMatchSnapshot();
42+
expect(formState.$touched).toMatchSnapshot();
3843

39-
expect(component.form.$$.ctx.$values).toMatchSnapshot();
40-
expect(component.form.$$.ctx.$errors).toMatchSnapshot();
41-
expect(component.form.$$.ctx.$touched).toMatchSnapshot();
4244
resetForm();
43-
expect(component.form.$$.ctx.$values).toMatchSnapshot();
44-
expect(component.form.$$.ctx.$errors).toMatchSnapshot();
45-
expect(component.form.$$.ctx.$touched).toMatchSnapshot();
45+
formState = component.form.$capture_state();
46+
expect(formState.$values).toMatchSnapshot();
47+
expect(formState.$errors).toMatchSnapshot();
48+
expect(formState.$touched).toMatchSnapshot();
4649

4750
done();
4851
}
@@ -68,7 +71,7 @@ describe('Form', () => {
6871

6972
const signInButton = getByText('Sign in');
7073

71-
expect(component.form.$$.ctx.$isSubmitting).toBe(false);
74+
expect(component.form.$capture_state().$isSubmitting).toBe(false);
7275
expect(signInButton).not.toHaveAttribute('disabled');
7376

7477
await fireEvent.click(signInButton);
@@ -81,11 +84,11 @@ describe('Form', () => {
8184
user: { email: 'initial@value.com' },
8285
},
8386
onSubmit: jest.fn(({ detail: { resetForm } }) => {
84-
expect(component.form.$$.ctx.$values.user.email).toEqual(
87+
expect(component.form.$capture_state().$values.user.email).toEqual(
8588
'test@user.com'
8689
);
8790
resetForm();
88-
expect(component.form.$$.ctx.$values.user.email).toEqual(
91+
expect(component.form.$capture_state().$values.user.email).toEqual(
8992
'initial@value.com'
9093
);
9194

@@ -110,13 +113,13 @@ describe('Form', () => {
110113
user: { email: 'initial@value.com' },
111114
},
112115
onSubmit: jest.fn(({ detail: { resetForm } }) => {
113-
expect(component.form.$$.ctx.$values.user.email).toEqual(
116+
expect(component.form.$capture_state().$values.user.email).toEqual(
114117
'test@user.com'
115118
);
116119
resetForm({
117120
user: { email: 'after@reset.com' },
118121
});
119-
expect(component.form.$$.ctx.$values.user.email).toEqual(
122+
expect(component.form.$capture_state().$values.user.email).toEqual(
120123
'after@reset.com'
121124
);
122125

@@ -160,7 +163,7 @@ describe('Form', () => {
160163
await wait(() => {
161164
expect(getByText('user.email must be a valid email')).toBeInTheDocument();
162165
});
163-
expect(component.form.$$.ctx.$errors).toEqual({
166+
expect(component.form.$capture_state().$errors).toEqual({
164167
user: { email: 'user.email must be a valid email' },
165168
});
166169

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

173-
expect(component.form.$$.ctx.$values).toMatchObject({
176+
expect(component.form.$capture_state().$values).toMatchObject({
174177
user: { email: '' },
175178
language: '',
176179
os: [],
177180
});
178-
expect(component.form.$$.ctx.$touched).toMatchObject({
181+
expect(component.form.$capture_state().$touched).toMatchObject({
179182
user: { email: false },
180183
language: false,
181184
os: false,
@@ -184,15 +187,15 @@ describe('Form', () => {
184187

185188
it('isValid is undefined initially', async () => {
186189
const { component } = await render(App);
187-
expect(component.form.$$.ctx.isValid).toBe(undefined);
190+
expect(component.form.$capture_state().isValid).toBe(undefined);
188191
});
189192

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

195-
expect(component.form.$$.ctx.$values).toMatchObject({
198+
expect(component.form.$capture_state().$values).toMatchObject({
196199
user: { email: 'test@user.com' },
197200
language: '',
198201
os: [],

tests/Input/Input.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Input', () => {
2323
target: { value: 'test@user.com' },
2424
});
2525

26-
expect(component.form.$$.ctx.$values).toMatchObject({
26+
expect(component.form.$capture_state().$values).toMatchObject({
2727
email: 'test@user.com',
2828
});
2929
});
@@ -43,7 +43,7 @@ describe('Input', () => {
4343
});
4444
await wait();
4545

46-
expect(component.form.$$.ctx.$errors).toEqual({
46+
expect(component.form.$capture_state().$errors).toEqual({
4747
email: 'email must be a valid email',
4848
});
4949
});
@@ -63,7 +63,7 @@ describe('Input', () => {
6363
});
6464
await wait();
6565

66-
expect(component.form.$$.ctx.$errors).toEqual({});
66+
expect(component.form.$capture_state().$errors).toEqual({});
6767
});
6868

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

85-
expect(component.form.$$.ctx.$errors).toEqual({
85+
expect(component.form.$capture_state().$errors).toEqual({
8686
email: 'email must be a valid email',
8787
});
8888
});
@@ -102,7 +102,7 @@ describe('Input', () => {
102102
});
103103
await fireEvent.blur(emailInput);
104104
await wait();
105-
expect(component.form.$$.ctx.$errors).toEqual({});
105+
expect(component.form.$capture_state().$errors).toEqual({});
106106
});
107107

108108
it('matches snapshot', async () => {

0 commit comments

Comments
 (0)