@testing-library/svelte 3.0.1 → 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.
Files changed (3) hide show
  1. package/README.md +17 -13
  2. package/dist/pure.js +14 -11
  3. package/package.json +9 -9
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/master/other/chipmunk.png"
9
+ src="https://raw.githubusercontent.com/testing-library/svelte-testing-library/main/other/chipmunk.png"
10
10
  />
11
11
  </a>
12
12
 
@@ -121,21 +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="Ben Monro"/><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="Emil Tholin"/><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="Eduardo Rabelo"/><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="Tim Deschryver"/><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="Emanuele"/><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="pngwn"/><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="Sebastian Silbermann"/><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="Rahim Alwer"/><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>
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>
134
137
  </tr>
135
138
  </table>
136
139
 
137
- <!-- markdownlint-enable -->
140
+ <!-- markdownlint-restore -->
138
141
  <!-- prettier-ignore-end -->
142
+
139
143
  <!-- ALL-CONTRIBUTORS-LIST:END -->
140
144
 
141
145
  This project follows the [all-contributors][all-contributors] specification.
@@ -158,14 +162,14 @@ Contributions of any kind welcome!
158
162
  [downloads-badge]: https://img.shields.io/npm/dm/@testing-library/svelte.svg?style=flat-square
159
163
  [npmtrends]: http://www.npmtrends.com/@testing-library/svelte
160
164
  [discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
161
- [discord]: https://discord.gg/c6JN9fM
165
+ [discord]: https://discord.gg/testing-library
162
166
  [license-badge]: https://img.shields.io/github/license/testing-library/svelte-testing-library?color=b
163
- [license]: https://github.com/testing-library/svelte-testing-library/blob/master/LICENSE
167
+ [license]: https://github.com/testing-library/svelte-testing-library/blob/main/LICENSE
164
168
  [prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
165
169
  [prs]: http://makeapullrequest.com
166
170
  [donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
167
171
  [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
168
- [coc]: https://github.com/testing-library/svelte-testing-library/blob/master/CODE_OF_CONDUCT.md
172
+ [coc]: https://github.com/testing-library/svelte-testing-library/blob/main/CODE_OF_CONDUCT.md
169
173
  [github-watch-badge]: https://img.shields.io/github/watchers/testing-library/svelte-testing-library.svg?style=social
170
174
  [github-watch]: https://github.com/testing-library/svelte-testing-library/watchers
171
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.act = exports.fireEvent = exports.cleanup = exports.render = void 0;
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
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
30
+ const _excluded = ["target"];
31
31
 
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 svleteComponentOptions = ['anchor', 'props', 'hydrate', 'intro'];
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, ["target"]);
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 => svleteComponentOptions.includes(option)); // Check if any props and Svelte options were accidentally mixed.
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 => !svleteComponentOptions.includes(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 [${svleteComponentOptions}]. You can either change the prop names, or pass in your
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.1",
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,26 +61,25 @@
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": "^26.0.0",
64
+ "@types/jest": "^27.0.0",
65
65
  "all-contributors-cli": "^6.9.0",
66
66
  "babel-eslint": "^10.0.3",
67
- "babel-jest": "^26.0.1",
68
- "doctoc": "^1.4.0",
67
+ "babel-jest": "^27.0.0",
68
+ "doctoc": "^2.0.0",
69
69
  "eslint": "^7.2.0",
70
70
  "eslint-config-standard": "^16.0.0",
71
71
  "eslint-plugin-import": "^2.18.2",
72
72
  "eslint-plugin-node": "^11.0.0",
73
73
  "eslint-plugin-promise": "^4.2.1",
74
- "eslint-plugin-simple-import-sort": "^6.0.0",
75
- "eslint-plugin-standard": "^4.0.1",
76
- "eslint-plugin-svelte3": "^2.7.3",
74
+ "eslint-plugin-simple-import-sort": "^7.0.0",
75
+ "eslint-plugin-svelte3": "^3.0.0",
77
76
  "husky": "^4.0.9",
78
- "jest": "^26.0.1",
77
+ "jest": "^27.0.0",
79
78
  "lint-staged": "^10.0.0",
80
79
  "npm-run-all": "^4.1.5",
81
80
  "prettier": "^2.0.1",
82
81
  "svelte": "^3.0.0",
83
- "svelte-jester": "^1.0.3"
82
+ "svelte-jester": "^2.1.4"
84
83
  },
85
84
  "husky": {
86
85
  "hooks": {
@@ -119,6 +118,7 @@
119
118
  "setupFilesAfterEnv": [
120
119
  "@testing-library/jest-dom/extend-expect"
121
120
  ],
121
+ "testEnvironment": "jsdom",
122
122
  "transform": {
123
123
  "^.+\\.js$": "babel-jest",
124
124
  "^.+\\.svelte$": "svelte-jester",