@testing-library/svelte 3.1.3 → 3.2.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 +1 -0
- package/dist/pure.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +15 -13
package/README.md
CHANGED
|
@@ -135,6 +135,7 @@ Thanks goes to these people ([emoji key][emojis]):
|
|
|
135
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
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>
|
|
137
137
|
<td align="center"><a href="https://johnbowser.dev/"><img src="https://avatars.githubusercontent.com/u/66637570?v=4?s=100" width="100px;" alt=""/><br /><sub><b>John Bowser</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=jgbowser" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=jgbowser" title="Tests">⚠️</a></td>
|
|
138
|
+
<td align="center"><a href="https://github.com/ysaskia"><img src="https://avatars.githubusercontent.com/u/1370679?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yoann</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=ysaskia" title="Code">💻</a></td>
|
|
138
139
|
</tr>
|
|
139
140
|
</table>
|
|
140
141
|
|
package/dist/pure.js
CHANGED
|
@@ -41,7 +41,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
41
41
|
|
|
42
42
|
const containerCache = new Map();
|
|
43
43
|
const componentCache = new Set();
|
|
44
|
-
const svelteComponentOptions = ['anchor', 'props', 'hydrate', 'intro', 'context'];
|
|
44
|
+
const svelteComponentOptions = ['accessors', 'anchor', 'props', 'hydrate', 'intro', 'context'];
|
|
45
45
|
|
|
46
46
|
const render = (Component, _ref = {}, {
|
|
47
47
|
container,
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -3,22 +3,24 @@
|
|
|
3
3
|
// Definitions by: Rahim Alwer <https://github.com/mihar-22>
|
|
4
4
|
|
|
5
5
|
import {queries, Queries, BoundFunction, EventType} from '@testing-library/dom'
|
|
6
|
-
import { SvelteComponent } from 'svelte/types/runtime'
|
|
6
|
+
import { SvelteComponent, ComponentProps } from 'svelte/types/runtime'
|
|
7
7
|
|
|
8
8
|
export * from '@testing-library/dom'
|
|
9
9
|
|
|
10
|
-
type SvelteComponentOptions =
|
|
10
|
+
type SvelteComponentOptions<C extends SvelteComponent> = ComponentProps<C> | {props: ComponentProps<C>}
|
|
11
11
|
|
|
12
12
|
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
|
|
13
13
|
|
|
14
|
+
type Constructor<T> = new (...args: any[]) => T;
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* Render a Component into the Document.
|
|
16
18
|
*/
|
|
17
|
-
export type RenderResult<Q extends Queries = typeof queries> = {
|
|
19
|
+
export type RenderResult<C extends SvelteComponent, Q extends Queries = typeof queries> = {
|
|
18
20
|
container: HTMLElement
|
|
19
|
-
component:
|
|
21
|
+
component: C
|
|
20
22
|
debug: (el?: HTMLElement | DocumentFragment) => void
|
|
21
|
-
rerender: (options: SvelteComponentOptions) => void
|
|
23
|
+
rerender: (options: SvelteComponentOptions<C>) => void
|
|
22
24
|
unmount: () => void
|
|
23
25
|
} & { [P in keyof Q]: BoundFunction<Q[P]> }
|
|
24
26
|
|
|
@@ -27,17 +29,17 @@ export interface RenderOptions<Q extends Queries = typeof queries> {
|
|
|
27
29
|
queries?: Q
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
export function render(
|
|
31
|
-
component:
|
|
32
|
-
componentOptions?: SvelteComponentOptions
|
|
32
|
+
export function render<C extends SvelteComponent>(
|
|
33
|
+
component: C,
|
|
34
|
+
componentOptions?: SvelteComponentOptions<C>,
|
|
33
35
|
renderOptions?: Omit<RenderOptions, 'queries'>
|
|
34
|
-
): RenderResult
|
|
36
|
+
): RenderResult<C>
|
|
35
37
|
|
|
36
|
-
export function render<Q extends Queries>(
|
|
37
|
-
component:
|
|
38
|
-
componentOptions?: SvelteComponentOptions
|
|
38
|
+
export function render<C extends SvelteComponent, Q extends Queries>(
|
|
39
|
+
component: Constructor<C>,
|
|
40
|
+
componentOptions?: SvelteComponentOptions<C>,
|
|
39
41
|
renderOptions?: RenderOptions<Q>,
|
|
40
|
-
): RenderResult<Q>
|
|
42
|
+
): RenderResult<C, Q>
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* Unmounts trees that were mounted with render.
|