@happyvertical/smrt-vitest 0.55.15 → 0.55.17
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/dist/.tsbuildinfo +1 -1
- package/dist/svelte.d.ts +11 -0
- package/dist/svelte.d.ts.map +1 -1
- package/dist/svelte.js +37 -0
- package/dist/svelte.js.map +1 -1
- package/package.json +2 -2
package/dist/svelte.d.ts
CHANGED
|
@@ -18,4 +18,15 @@
|
|
|
18
18
|
export { cleanup, fireEvent, render, screen, within, } from '@testing-library/svelte';
|
|
19
19
|
export { default as userEvent } from '@testing-library/user-event';
|
|
20
20
|
export { expectNoA11yViolations } from './a11y.js';
|
|
21
|
+
/**
|
|
22
|
+
* Styling/testing hooks: find an internal element by its `data-smrt-part` name
|
|
23
|
+
* inside the rendered `data-smrt-component` root. Parts are public names (see
|
|
24
|
+
* packages/smrt-ui/agents/styling.md), so tests should target them rather than
|
|
25
|
+
* generated class names.
|
|
26
|
+
*
|
|
27
|
+
* const tab = getByPart('Tabs', 'tab', container);
|
|
28
|
+
*/
|
|
29
|
+
export declare function getByPart(component: string, part: string, container?: ParentNode): HTMLElement;
|
|
30
|
+
/** Like getByPart, but returns null when nothing matches (throws on several). */
|
|
31
|
+
export declare function queryByPart(component: string, part: string, container?: ParentNode): HTMLElement | null;
|
|
21
32
|
//# sourceMappingURL=svelte.d.ts.map
|
package/dist/svelte.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svelte.d.ts","sourceRoot":"","sources":["../src/svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,GACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"svelte.d.ts","sourceRoot":"","sources":["../src/svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,GACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,UAA0B,GACpC,WAAW,CAQb;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,UAA0B,GACpC,WAAW,GAAG,IAAI,CAQpB"}
|
package/dist/svelte.js
CHANGED
|
@@ -18,4 +18,41 @@
|
|
|
18
18
|
export { cleanup, fireEvent, render, screen, within, } from '@testing-library/svelte';
|
|
19
19
|
export { default as userEvent } from '@testing-library/user-event';
|
|
20
20
|
export { expectNoA11yViolations } from './a11y.js';
|
|
21
|
+
/**
|
|
22
|
+
* Styling/testing hooks: find an internal element by its `data-smrt-part` name
|
|
23
|
+
* inside the rendered `data-smrt-component` root. Parts are public names (see
|
|
24
|
+
* packages/smrt-ui/agents/styling.md), so tests should target them rather than
|
|
25
|
+
* generated class names.
|
|
26
|
+
*
|
|
27
|
+
* const tab = getByPart('Tabs', 'tab', container);
|
|
28
|
+
*/
|
|
29
|
+
export function getByPart(component, part, container = document.body) {
|
|
30
|
+
const matches = findByPart(component, part, container);
|
|
31
|
+
if (matches.length !== 1) {
|
|
32
|
+
throw new Error(`getByPart(${JSON.stringify(component)}, ${JSON.stringify(part)}) found ${matches.length} elements; expected exactly 1`);
|
|
33
|
+
}
|
|
34
|
+
return matches[0];
|
|
35
|
+
}
|
|
36
|
+
/** Like getByPart, but returns null when nothing matches (throws on several). */
|
|
37
|
+
export function queryByPart(component, part, container = document.body) {
|
|
38
|
+
const matches = findByPart(component, part, container);
|
|
39
|
+
if (matches.length > 1) {
|
|
40
|
+
throw new Error(`queryByPart(${JSON.stringify(component)}, ${JSON.stringify(part)}) found ${matches.length} elements; expected at most 1`);
|
|
41
|
+
}
|
|
42
|
+
return matches[0] ?? null;
|
|
43
|
+
}
|
|
44
|
+
function findByPart(component, part, container) {
|
|
45
|
+
const quote = (value) => value.replace(/["\\]/g, '\\$&');
|
|
46
|
+
const roots = container.querySelectorAll(`[data-smrt-component="${quote(component)}"]`);
|
|
47
|
+
const found = new Set();
|
|
48
|
+
for (const root of Array.from(roots)) {
|
|
49
|
+
// Only parts whose nearest component root is this root: a nested component's
|
|
50
|
+
// part with the same name belongs to that component, not to this one.
|
|
51
|
+
for (const el of Array.from(root.querySelectorAll(`[data-smrt-part="${quote(part)}"]`))) {
|
|
52
|
+
if (el.closest('[data-smrt-component]') === root)
|
|
53
|
+
found.add(el);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return [...found];
|
|
57
|
+
}
|
|
21
58
|
//# sourceMappingURL=svelte.js.map
|
package/dist/svelte.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svelte.js","sourceRoot":"","sources":["../src/svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,GACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"svelte.js","sourceRoot":"","sources":["../src/svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,OAAO,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AC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,SAAS,CAAC,gBAAgB,CACtC,yBAAyB,KAAK,CAAC,SAAS,CAAC,IAAI,CAC9C,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,GAAG,EAAe,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,6EAA6E;QAC7E,sEAAsE;QACtE,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,CACzB,IAAI,CAAC,gBAAgB,CAAc,oBAAoB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CACxE,EAAE,CAAC;YACF,IAAI,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI;gBAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-vitest",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.17",
|
|
4
4
|
"description": "Vitest plugin for automatic cross-package manifest loading in SMRT tests",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@happyvertical/smrt-core": "0.55.
|
|
57
|
+
"@happyvertical/smrt-core": "0.55.17",
|
|
58
58
|
"@happyvertical/sql": "^0.103.4",
|
|
59
59
|
"@testing-library/jest-dom": "^7.0.1",
|
|
60
60
|
"@testing-library/svelte": "^5.4.2",
|