@testing-library/svelte 3.0.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -14
- package/dist/pure.js +14 -11
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
height="80"
|
|
7
7
|
width="80"
|
|
8
8
|
alt="chipmunk"
|
|
9
|
-
src="https://raw.githubusercontent.com/testing-library/svelte-testing-library/
|
|
9
|
+
src="https://raw.githubusercontent.com/testing-library/svelte-testing-library/main/other/chipmunk.png"
|
|
10
10
|
/>
|
|
11
11
|
</a>
|
|
12
12
|
|
|
@@ -121,22 +121,25 @@ Thanks goes to these people ([emoji key][emojis]):
|
|
|
121
121
|
<!-- markdownlint-disable -->
|
|
122
122
|
<table>
|
|
123
123
|
<tr>
|
|
124
|
-
<td align="center"><a href="https://github.com/benmonro"><img src="https://avatars3.githubusercontent.com/u/399236?v=4" width="100px;" alt=""/><br /><sub><b>Ben Monro</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Tests">⚠️</a> <a href="#ideas-benmonro" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Documentation">📖</a></td>
|
|
125
|
-
<td align="center"><a href="https://twitter.com/EmilTholin"><img src="https://avatars0.githubusercontent.com/u/11573167?v=4" width="100px;" alt=""/><br /><sub><b>Emil Tholin</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Tests">⚠️</a> <a href="#ideas-EmilTholin" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
126
|
-
<td align="center"><a href="https://medium.com/@oieduardorabelo"><img src="https://avatars1.githubusercontent.com/u/829902?v=4" width="100px;" alt=""/><br /><sub><b>Eduardo Rabelo</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Documentation">📖</a> <a href="#example-oieduardorabelo" title="Examples">💡</a></td>
|
|
127
|
-
<td align="center"><a href="http://timdeschryver.dev"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt=""/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=timdeschryver" title="Documentation">📖</a></td>
|
|
128
|
-
<td align="center"><a href="http://www.ematipico.com"><img src="https://avatars3.githubusercontent.com/u/602478?v=4" width="100px;" alt=""/><br /><sub><b>Emanuele</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Documentation">📖</a></td>
|
|
129
|
-
<td align="center"><a href="https://github.com/pngwn"><img src="https://avatars1.githubusercontent.com/u/12937446?v=4" width="100px;" alt=""/><br /><sub><b>pngwn</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=pngwn" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=pngwn" title="Tests">⚠️</a></td>
|
|
130
|
-
<td align="center"><a href="https://twitter.com/sebsilbermann"><img src="https://avatars3.githubusercontent.com/u/12292047?v=4" width="100px;" alt=""/><br /><sub><b>Sebastian Silbermann</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=eps1lon" title="Code">💻</a></td>
|
|
124
|
+
<td align="center"><a href="https://github.com/benmonro"><img src="https://avatars3.githubusercontent.com/u/399236?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ben Monro</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Tests">⚠️</a> <a href="#ideas-benmonro" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Documentation">📖</a></td>
|
|
125
|
+
<td align="center"><a href="https://twitter.com/EmilTholin"><img src="https://avatars0.githubusercontent.com/u/11573167?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Emil Tholin</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Tests">⚠️</a> <a href="#ideas-EmilTholin" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
126
|
+
<td align="center"><a href="https://medium.com/@oieduardorabelo"><img src="https://avatars1.githubusercontent.com/u/829902?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Eduardo Rabelo</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Documentation">📖</a> <a href="#example-oieduardorabelo" title="Examples">💡</a></td>
|
|
127
|
+
<td align="center"><a href="http://timdeschryver.dev"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=timdeschryver" title="Documentation">📖</a></td>
|
|
128
|
+
<td align="center"><a href="http://www.ematipico.com"><img src="https://avatars3.githubusercontent.com/u/602478?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Emanuele</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=ematipico" title="Documentation">📖</a></td>
|
|
129
|
+
<td align="center"><a href="https://github.com/pngwn"><img src="https://avatars1.githubusercontent.com/u/12937446?v=4?s=100" width="100px;" alt=""/><br /><sub><b>pngwn</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=pngwn" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=pngwn" title="Tests">⚠️</a></td>
|
|
130
|
+
<td align="center"><a href="https://twitter.com/sebsilbermann"><img src="https://avatars3.githubusercontent.com/u/12292047?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sebastian Silbermann</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=eps1lon" title="Code">💻</a></td>
|
|
131
131
|
</tr>
|
|
132
132
|
<tr>
|
|
133
|
-
<td align="center"><a href="https://github.com/mihar-22"><img src="https://avatars3.githubusercontent.com/u/14304599?s=460&v=4" width="100px;" alt=""/><br /><sub><b>Rahim Alwer</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Documentation">📖</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Tests">⚠️</a></td>
|
|
134
|
-
<td align="center"><a href="https://github.com/MirrorBytes"><img src="https://avatars3.githubusercontent.com/u/22119469?v=4" width="100px;" alt=""/><br /><sub><b>Bob</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/issues?q=author%3AMirrorBytes" title="Bug reports">🐛</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=MirrorBytes" title="Code">💻</a></td>
|
|
133
|
+
<td align="center"><a href="https://github.com/mihar-22"><img src="https://avatars3.githubusercontent.com/u/14304599?s=460&v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rahim Alwer</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Documentation">📖</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=mihar-22" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/pulls?q=is%3Apr+reviewed-by%3Amihar-22" title="Reviewed Pull Requests">👀</a></td>
|
|
134
|
+
<td align="center"><a href="https://github.com/MirrorBytes"><img src="https://avatars3.githubusercontent.com/u/22119469?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bob</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/issues?q=author%3AMirrorBytes" title="Bug reports">🐛</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=MirrorBytes" title="Code">💻</a></td>
|
|
135
|
+
<td align="center"><a href="https://github.com/ronmerkin"><img src="https://avatars.githubusercontent.com/u/17492527?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ron Merkin</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=ronmerkin" title="Code">💻</a></td>
|
|
136
|
+
<td align="center"><a href="http://www.benmccann.com"><img src="https://avatars.githubusercontent.com/u/322311?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ben McCann</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmccann" title="Tests">⚠️</a></td>
|
|
135
137
|
</tr>
|
|
136
138
|
</table>
|
|
137
139
|
|
|
138
|
-
<!-- markdownlint-
|
|
140
|
+
<!-- markdownlint-restore -->
|
|
139
141
|
<!-- prettier-ignore-end -->
|
|
142
|
+
|
|
140
143
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
141
144
|
|
|
142
145
|
This project follows the [all-contributors][all-contributors] specification.
|
|
@@ -159,14 +162,14 @@ Contributions of any kind welcome!
|
|
|
159
162
|
[downloads-badge]: https://img.shields.io/npm/dm/@testing-library/svelte.svg?style=flat-square
|
|
160
163
|
[npmtrends]: http://www.npmtrends.com/@testing-library/svelte
|
|
161
164
|
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
|
|
162
|
-
[discord]: https://discord.gg/
|
|
165
|
+
[discord]: https://discord.gg/testing-library
|
|
163
166
|
[license-badge]: https://img.shields.io/github/license/testing-library/svelte-testing-library?color=b
|
|
164
|
-
[license]: https://github.com/testing-library/svelte-testing-library/blob/
|
|
167
|
+
[license]: https://github.com/testing-library/svelte-testing-library/blob/main/LICENSE
|
|
165
168
|
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
|
|
166
169
|
[prs]: http://makeapullrequest.com
|
|
167
170
|
[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
|
|
168
171
|
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
|
|
169
|
-
[coc]: https://github.com/testing-library/svelte-testing-library/blob/
|
|
172
|
+
[coc]: https://github.com/testing-library/svelte-testing-library/blob/main/CODE_OF_CONDUCT.md
|
|
170
173
|
[github-watch-badge]: https://img.shields.io/github/watchers/testing-library/svelte-testing-library.svg?style=social
|
|
171
174
|
[github-watch]: https://github.com/testing-library/svelte-testing-library/watchers
|
|
172
175
|
[github-star-badge]: https://img.shields.io/github/stars/testing-library/svelte-testing-library.svg?style=social
|
package/dist/pure.js
CHANGED
|
@@ -9,7 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
fireEvent: true,
|
|
10
10
|
act: true
|
|
11
11
|
};
|
|
12
|
-
exports.
|
|
12
|
+
exports.render = exports.fireEvent = exports.cleanup = exports.act = void 0;
|
|
13
13
|
|
|
14
14
|
var _dom = require("@testing-library/dom");
|
|
15
15
|
|
|
@@ -27,9 +27,11 @@ Object.keys(_dom).forEach(function (key) {
|
|
|
27
27
|
|
|
28
28
|
var _svelte = require("svelte");
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const _excluded = ["target"];
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
35
|
|
|
34
36
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
37
|
|
|
@@ -39,7 +41,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
39
41
|
|
|
40
42
|
const containerCache = new Map();
|
|
41
43
|
const componentCache = new Set();
|
|
42
|
-
const
|
|
44
|
+
const svelteComponentOptions = ['anchor', 'props', 'hydrate', 'intro', 'context'];
|
|
43
45
|
|
|
44
46
|
const render = (Component, _ref = {}, {
|
|
45
47
|
container,
|
|
@@ -48,23 +50,23 @@ const render = (Component, _ref = {}, {
|
|
|
48
50
|
let {
|
|
49
51
|
target
|
|
50
52
|
} = _ref,
|
|
51
|
-
options = _objectWithoutProperties(_ref,
|
|
53
|
+
options = _objectWithoutProperties(_ref, _excluded);
|
|
52
54
|
|
|
53
55
|
container = container || document.body;
|
|
54
56
|
target = target || container.appendChild(document.createElement('div'));
|
|
55
57
|
const ComponentConstructor = Component.default || Component;
|
|
56
58
|
|
|
57
59
|
const checkProps = options => {
|
|
58
|
-
const isProps = !Object.keys(options).some(option =>
|
|
60
|
+
const isProps = !Object.keys(options).some(option => svelteComponentOptions.includes(option)); // Check if any props and Svelte options were accidentally mixed.
|
|
59
61
|
|
|
60
62
|
if (!isProps) {
|
|
61
|
-
const unrecognizedOptions = Object.keys(options).filter(option => !
|
|
63
|
+
const unrecognizedOptions = Object.keys(options).filter(option => !svelteComponentOptions.includes(option));
|
|
62
64
|
|
|
63
65
|
if (unrecognizedOptions.length > 0) {
|
|
64
66
|
throw Error(`
|
|
65
|
-
Unknown options were found [${unrecognizedOptions}]. This might happen if you've mixed
|
|
66
|
-
passing in props with Svelte options into the render function. Valid Svelte options
|
|
67
|
-
are [${
|
|
67
|
+
Unknown options were found [${unrecognizedOptions}]. This might happen if you've mixed
|
|
68
|
+
passing in props with Svelte options into the render function. Valid Svelte options
|
|
69
|
+
are [${svelteComponentOptions}]. You can either change the prop names, or pass in your
|
|
68
70
|
props for that component via the \`props\` option.\n\n
|
|
69
71
|
Eg: const { /** Results **/ } = render(MyComponent, { props: { /** props here **/ } })\n\n
|
|
70
72
|
`);
|
|
@@ -162,4 +164,5 @@ Object.keys(_dom.fireEvent).forEach(key => {
|
|
|
162
164
|
await (0, _svelte.tick)();
|
|
163
165
|
return event;
|
|
164
166
|
};
|
|
165
|
-
});
|
|
167
|
+
});
|
|
168
|
+
/* eslint-disable import/export */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/svelte",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Simple and complete Svelte testing utilities that encourage good testing practices.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"@commitlint/cli": "^11.0.0",
|
|
62
62
|
"@commitlint/config-conventional": "^11.0.0",
|
|
63
63
|
"@testing-library/jest-dom": "^5.0.2",
|
|
64
|
-
"@types/jest": "^
|
|
64
|
+
"@types/jest": "^27.0.0",
|
|
65
65
|
"all-contributors-cli": "^6.9.0",
|
|
66
66
|
"babel-eslint": "^10.0.3",
|
|
67
|
-
"babel-jest": "^
|
|
67
|
+
"babel-jest": "^27.0.0",
|
|
68
68
|
"doctoc": "^2.0.0",
|
|
69
69
|
"eslint": "^7.2.0",
|
|
70
70
|
"eslint-config-standard": "^16.0.0",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
75
75
|
"eslint-plugin-svelte3": "^3.0.0",
|
|
76
76
|
"husky": "^4.0.9",
|
|
77
|
-
"jest": "^
|
|
77
|
+
"jest": "^27.0.0",
|
|
78
78
|
"lint-staged": "^10.0.0",
|
|
79
79
|
"npm-run-all": "^4.1.5",
|
|
80
80
|
"prettier": "^2.0.1",
|
|
81
81
|
"svelte": "^3.0.0",
|
|
82
|
-
"svelte-jester": "^1.
|
|
82
|
+
"svelte-jester": "^2.1.4"
|
|
83
83
|
},
|
|
84
84
|
"husky": {
|
|
85
85
|
"hooks": {
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"setupFilesAfterEnv": [
|
|
119
119
|
"@testing-library/jest-dom/extend-expect"
|
|
120
120
|
],
|
|
121
|
+
"testEnvironment": "jsdom",
|
|
121
122
|
"transform": {
|
|
122
123
|
"^.+\\.js$": "babel-jest",
|
|
123
124
|
"^.+\\.svelte$": "svelte-jester",
|