@testing-library/svelte 1.0.0-next.1 → 1.0.0-next.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.
@@ -0,0 +1,3 @@
1
+ export * from "@testing-library/dom";
2
+ export { act, cleanup, fireEvent, render, setup, UnknownSvelteOptionsError } from "./pure.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
package/dist/pure.d.ts ADDED
@@ -0,0 +1,105 @@
1
+ export { UnknownSvelteOptionsError } from "@testing-library/svelte-core";
2
+ /**
3
+ * Customize how Svelte renders the component.
4
+ */
5
+ export type SvelteComponentOptions<C extends import("@testing-library/svelte-core/types").Component> = import("@testing-library/svelte-core/types").ComponentOptions<C>;
6
+ /**
7
+ * Customize how Testing Library sets up the document and binds queries.
8
+ */
9
+ export type RenderOptions<Q extends import("@testing-library/dom").Queries = typeof import("@testing-library/dom/types/queries.js")> = {
10
+ baseElement?: HTMLElement;
11
+ queries?: Q;
12
+ };
13
+ /**
14
+ * The rendered component and bound testing functions.
15
+ */
16
+ export type RenderResult<C extends import("@testing-library/svelte-core/types").Component, Q extends import("@testing-library/dom").Queries = typeof import("@testing-library/dom/types/queries.js")> = {
17
+ container: HTMLElement;
18
+ baseElement: HTMLElement;
19
+ component: import("@testing-library/svelte-core/types").Exports<C>;
20
+ debug: (el?: HTMLElement | DocumentFragment) => void;
21
+ rerender: import("@testing-library/svelte-core/types").Rerender<C>;
22
+ unmount: () => void;
23
+ } & { [P in keyof Q]: import("@testing-library/dom").BoundFunction<Q[P]>; };
24
+ export type FireFunction = (...args: Parameters<import("@testing-library/dom").FireFunction>) => Promise<ReturnType<import("@testing-library/dom").FireFunction>>;
25
+ export type FireObject = { [K in import("@testing-library/dom").EventType]: (...args: Parameters<import("@testing-library/dom").FireObject[K]>) => Promise<ReturnType<import("@testing-library/dom").FireObject[K]>>; };
26
+ /**
27
+ * Call a function and wait for Svelte to flush pending changes.
28
+ *
29
+ * @template T
30
+ * @param {(() => Promise<T>) | () => T} [fn] - A function, which may be `async`, to call before flushing updates.
31
+ * @returns {Promise<T>}
32
+ */
33
+ export function act<T>(fn?: (() => Promise<T>) | (() => T)): Promise<T>;
34
+ /** Unmount components, remove elements added to `<body>`, and reset `@testing-library/dom`. */
35
+ export function cleanup(): void;
36
+ /**
37
+ * @typedef {(...args: Parameters<import('@testing-library/dom').FireFunction>) => Promise<ReturnType<import('@testing-library/dom').FireFunction>>} FireFunction
38
+ */
39
+ /**
40
+ * @typedef {{
41
+ * [K in import('@testing-library/dom').EventType]: (...args: Parameters<import('@testing-library/dom').FireObject[K]>) => Promise<ReturnType<import('@testing-library/dom').FireObject[K]>>
42
+ * }} FireObject
43
+ */
44
+ /**
45
+ * Fire an event on an element.
46
+ *
47
+ * Consider using `@testing-library/user-event` instead, if possible.
48
+ * @see https://testing-library.com/docs/user-event/intro/
49
+ *
50
+ * @type {FireFunction & FireObject}
51
+ */
52
+ export const fireEvent: FireFunction & FireObject;
53
+ /**
54
+ * Customize how Svelte renders the component.
55
+ *
56
+ * @template {import('@testing-library/svelte-core/types').Component} C
57
+ * @typedef {import('@testing-library/svelte-core/types').ComponentOptions<C>} SvelteComponentOptions
58
+ */
59
+ /**
60
+ * Customize how Testing Library sets up the document and binds queries.
61
+ *
62
+ * @template {import('@testing-library/dom').Queries} [Q=typeof import('@testing-library/dom').queries]
63
+ * @typedef {{
64
+ * baseElement?: HTMLElement
65
+ * queries?: Q
66
+ * }} RenderOptions
67
+ */
68
+ /**
69
+ * The rendered component and bound testing functions.
70
+ *
71
+ * @template {import('@testing-library/svelte-core/types').Component} C
72
+ * @template {import('@testing-library/dom').Queries} [Q=typeof import('@testing-library/dom').queries]
73
+ *
74
+ * @typedef {{
75
+ * container: HTMLElement
76
+ * baseElement: HTMLElement
77
+ * component: import('@testing-library/svelte-core/types').Exports<C>
78
+ * debug: (el?: HTMLElement | DocumentFragment) => void
79
+ * rerender: import('@testing-library/svelte-core/types').Rerender<C>
80
+ * unmount: () => void
81
+ * } & {
82
+ * [P in keyof Q]: import('@testing-library/dom').BoundFunction<Q[P]>
83
+ * }} RenderResult
84
+ */
85
+ /**
86
+ * Render a component into the document.
87
+ *
88
+ * @template {import('@testing-library/svelte-core/types').Component} C
89
+ * @template {import('@testing-library/dom').Queries} [Q=typeof import('@testing-library/dom').queries]
90
+ *
91
+ * @param {import('@testing-library/svelte-core/types').ComponentImport<C>} Component - The component to render.
92
+ * @param {SvelteComponentOptions<C>} options - Customize how Svelte renders the component.
93
+ * @param {RenderOptions<Q>} renderOptions - Customize how Testing Library sets up the document and binds queries.
94
+ * @returns {RenderResult<C, Q>} The rendered component and bound testing functions.
95
+ */
96
+ export function render<C extends import("@testing-library/svelte-core/types").Component, Q extends import("@testing-library/dom").Queries = typeof import("@testing-library/dom/types/queries.js")>(Component: import("@testing-library/svelte-core/types").ComponentImport<C>, options?: SvelteComponentOptions<C>, renderOptions?: RenderOptions<Q>): RenderResult<C, Q>;
97
+ /**
98
+ * Configure `@testing-library/dom` for usage with Svelte.
99
+ *
100
+ * Ensures events fired from `@testing-library/dom`
101
+ * and `@testing-library/user-event` wait for Svelte
102
+ * to flush changes to the DOM before proceeding.
103
+ */
104
+ export function setup(): void;
105
+ //# sourceMappingURL=pure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.d.ts","sourceRoot":"","sources":["../src/pure.js"],"names":[],"mappings":";;;;mCAasE,CAAC,SAA1D,OAAQ,oCAAoC,EAAE,SAAU,IACxD,OAAO,oCAAoC,EAAE,gBAAgB,CAAC,CAAC,CAAC;;;;0BAMtB,CAAC,SAA3C,OAAQ,sBAAsB,EAAE,OAAQ,6DACxC;IACR,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,OAAO,CAAC,EAAE,CAAC,CAAA;CACZ;;;;yBAMkE,CAAC,SAA1D,OAAQ,oCAAoC,EAAE,S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H,uBARsE,CAAC,SAA1D,OAAQ,oCAAoC,EAAE,SAAU,EACd,CAAC,SAA3C,OAAQ,sBAAsB,EAAE,OAAQ,sEAE1C,OAAO,oCAAoC,EAAE,eAAe,CAAC,CAAC,CAAC,YAC/D,sBAAsB,CAAC,CAAC,CAAC,kBACzB,aAAa,CAAC,CAAC,CAAC,GACd,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAkB9B;AAED;;;;;;GAMG;AACH,8BAWC"}
package/dist/vite.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export function svelteTesting({ resolveBrowser, autoCleanup, noExternal, }?: {
2
+ resolveBrowser?: boolean;
3
+ autoCleanup?: boolean;
4
+ noExternal?: boolean;
5
+ }): import("vite").Plugin;
6
+ //# sourceMappingURL=vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.js"],"names":[],"mappings":"AAcO,6EAHI;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAC,GACrE,OAAO,MAAM,EAAE,MAAM,CAyBhC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=vitest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.js"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/svelte",
3
- "version": "1.0.0-next.1",
3
+ "version": "1.0.0-next.2",
4
4
  "description": "Simple and complete Svelte testing utilities that encourage good testing practices.",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@testing-library/dom": "9.x.x || 10.x.x",
70
- "@testing-library/svelte-core": "1.0.0-next.1"
70
+ "@testing-library/svelte-core": "1.0.0-next.2"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public",