@describe-me/vitest 0.3.0 → 0.5.0-next.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 (48) hide show
  1. package/README.md +16 -5
  2. package/dist/adapter-package-root.d.ts +7 -0
  3. package/dist/adapter-package-root.js +40 -0
  4. package/dist/asset-store.d.ts +51 -0
  5. package/dist/asset-store.js +233 -0
  6. package/dist/collect-component-docs.d.ts +8 -3
  7. package/dist/collect-component-docs.js +37 -8
  8. package/dist/compile-globs.d.ts +6 -0
  9. package/dist/compile-globs.js +20 -0
  10. package/dist/component-entries.js +5 -1
  11. package/dist/extract-props.js +87 -15
  12. package/dist/file-filter.d.ts +7 -0
  13. package/dist/file-filter.js +23 -0
  14. package/dist/is-recorded-test.d.ts +6 -0
  15. package/dist/is-recorded-test.js +3 -0
  16. package/dist/mirror-react-act-environment.d.ts +8 -0
  17. package/dist/mirror-react-act-environment.js +27 -0
  18. package/dist/patch-testing-library-user-event.d.ts +3 -2
  19. package/dist/patch-testing-library-user-event.js +11 -4
  20. package/dist/plugin.d.ts +22 -0
  21. package/dist/plugin.js +94 -10
  22. package/dist/print-diagnostics.d.ts +7 -0
  23. package/dist/print-diagnostics.js +31 -0
  24. package/dist/project-module-path.d.ts +7 -0
  25. package/dist/project-module-path.js +23 -0
  26. package/dist/read-runtime-options.d.ts +3 -0
  27. package/dist/read-runtime-options.js +6 -0
  28. package/dist/register-exports.d.ts +28 -0
  29. package/dist/register-exports.js +118 -0
  30. package/dist/register-recording-hooks.d.ts +7 -4
  31. package/dist/register-recording-hooks.js +33 -9
  32. package/dist/reporter.d.ts +30 -1
  33. package/dist/reporter.js +88 -12
  34. package/dist/runtime-options.d.ts +22 -0
  35. package/dist/runtime-options.js +7 -0
  36. package/dist/setup-dom.js +9 -5
  37. package/dist/setup.js +4 -2
  38. package/dist/snapshot-store.d.ts +2 -2
  39. package/dist/snapshot-store.js +2 -3
  40. package/dist/split-stylesheet.d.ts +7 -0
  41. package/dist/split-stylesheet.js +114 -0
  42. package/dist/style-store.d.ts +25 -0
  43. package/dist/style-store.js +90 -0
  44. package/dist/styled-components-browser-build.d.ts +15 -0
  45. package/dist/styled-components-browser-build.js +69 -0
  46. package/package.json +8 -6
  47. package/dist/element-label.d.ts +0 -6
  48. package/dist/element-label.js +0 -34
@@ -1,34 +0,0 @@
1
- /** Attributes that name an element better than its text, in order of preference. */
2
- const NAME_ATTRIBUTES = ['aria-label', 'name', 'placeholder', 'title'];
3
- function roleOf(element) {
4
- const explicit = element.getAttribute('role');
5
- if (explicit) {
6
- return explicit;
7
- }
8
- const tag = element.tagName.toLowerCase();
9
- if (tag === 'input') {
10
- return element.getAttribute('type') ?? 'input';
11
- }
12
- return tag;
13
- }
14
- function nameOf(element) {
15
- for (const attribute of NAME_ATTRIBUTES) {
16
- const value = element.getAttribute(attribute);
17
- if (value) {
18
- return value;
19
- }
20
- }
21
- return (element.textContent ?? '').trim().slice(0, 40);
22
- }
23
- /**
24
- * A readable target for a frame label, e.g. `button "show details"`.
25
- * Testing Library hands interactions a real `Element` rather than a Vitest
26
- * locator, so the label is read off the element instead of a selector string.
27
- */
28
- export function elementLabel(target) {
29
- if (typeof Element === 'undefined' || !(target instanceof Element)) {
30
- return undefined;
31
- }
32
- const name = nameOf(target);
33
- return name ? `${roleOf(target)} "${name}"` : roleOf(target);
34
- }