@testing-library/svelte 3.1.1 → 3.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/svelte",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
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",
@@ -14,7 +14,7 @@
14
14
  "url": "https://github.com/testing-library/svelte-testing-library/issues"
15
15
  },
16
16
  "engines": {
17
- "node": ">= 8"
17
+ "node": ">= 10"
18
18
  },
19
19
  "keywords": [
20
20
  "testing",
package/types/index.d.ts CHANGED
@@ -3,11 +3,18 @@
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 { SvelteComponentTyped } from 'svelte/types/runtime'
7
7
 
8
8
  export * from '@testing-library/dom'
9
9
 
10
- type SvelteComponentOptions = any
10
+ export interface SvelteComponentOptions<P extends Record<string, any> = any> {
11
+ target?: HTMLElement
12
+ anchor?: string
13
+ props?: P
14
+ context?: any
15
+ hydrate?: boolean
16
+ intro?: boolean
17
+ }
11
18
 
12
19
  type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
13
20
 
@@ -15,30 +22,41 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
15
22
  * Render a Component into the Document.
16
23
  */
17
24
  export type RenderResult<Q extends Queries = typeof queries> = {
18
- container: HTMLElement
25
+ container: Element
19
26
  component: SvelteComponent
20
- debug: (el?: HTMLElement | DocumentFragment) => void
27
+ component: SvelteComponentTyped
28
+ debug: (el?: Element | DocumentFragment) => void
21
29
  rerender: (options: SvelteComponentOptions) => void
22
30
  unmount: () => void
23
31
  } & { [P in keyof Q]: BoundFunction<Q[P]> }
24
32
 
25
33
  export interface RenderOptions<Q extends Queries = typeof queries> {
26
- container?: HTMLElement
34
+ container?: Element
27
35
  queries?: Q
28
36
  }
29
37
 
30
38
  export function render(
31
- component: typeof SvelteComponent,
39
+ component: SvelteComponentTyped,
32
40
  componentOptions?: SvelteComponentOptions,
33
41
  renderOptions?: Omit<RenderOptions, 'queries'>
34
42
  ): RenderResult
35
43
 
36
44
  export function render<Q extends Queries>(
37
- component: typeof SvelteComponent,
45
+ component: SvelteComponentTyped,
38
46
  componentOptions?: SvelteComponentOptions,
39
47
  renderOptions?: RenderOptions<Q>,
40
48
  ): RenderResult<Q>
41
49
 
50
+ export function render<
51
+ P extends Record<string, any> = any,
52
+ E extends Record<string, any> = any,
53
+ S extends Record<string, any> = any
54
+ >(
55
+ component: SvelteComponentTyped<P, E, S>,
56
+ componentOptions?: SvelteComponentOptions<P>,
57
+ renderOptions?: Omit<RenderOptions, "queries">
58
+ ): RenderResult;
59
+
42
60
  /**
43
61
  * Unmounts trees that were mounted with render.
44
62
  */
package/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- # CHANGELOG
2
-
3
- The changelog is automatically updated using
4
- [semantic-release](https://github.com/semantic-release/semantic-release). You
5
- can see it on the [releases page](../../releases).