@rind-ui/testing 1.1.0 → 1.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.
@@ -1,7 +1,7 @@
1
1
  //#region \0rolldown/runtime.js
2
2
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
3
3
  //#endregion
4
- //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_cf06651230fa8e4c6e2eddd3c1abf6a9/node_modules/vitest/dist/chunks/tinyrainbow.Do8I1XRG.js
4
+ //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_5800036d204cd94ebff73363fb6967a0/node_modules/vitest/dist/chunks/tinyrainbow.Do8I1XRG.js
5
5
  var d$1 = (e) => String(e);
6
6
  d$1.open = d$1.close = "";
7
7
  var i$1 = () => d$1;
@@ -86,7 +86,7 @@ function h$1({ force: e } = {}) {
86
86
  }
87
87
  var $ = h$1();
88
88
  //#endregion
89
- //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_cf06651230fa8e4c6e2eddd3c1abf6a9/node_modules/vitest/dist/chunks/index.D0heQG4v.js
89
+ //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_5800036d204cd94ebff73363fb6967a0/node_modules/vitest/dist/chunks/index.D0heQG4v.js
90
90
  function _mergeNamespaces(n, m) {
91
91
  m.forEach(function(e) {
92
92
  e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
@@ -1248,7 +1248,7 @@ const plugins = {
1248
1248
  Error: ErrorPlugin
1249
1249
  };
1250
1250
  //#endregion
1251
- //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_cf06651230fa8e4c6e2eddd3c1abf6a9/node_modules/vitest/dist/chunks/display.BlTmubjj.js
1251
+ //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_5800036d204cd94ebff73363fb6967a0/node_modules/vitest/dist/chunks/display.BlTmubjj.js
1252
1252
  const { AsymmetricMatcher: AsymmetricMatcher$1, DOMCollection: DOMCollection$1, DOMElement: DOMElement$1, Immutable: Immutable$1, ReactElement: ReactElement$1, ReactTestComponent: ReactTestComponent$1 } = plugins;
1253
1253
  const PLUGINS$1 = [
1254
1254
  ReactTestComponent$1,
@@ -1601,7 +1601,7 @@ const isAbsolute = function(p) {
1601
1601
  return _IS_ABSOLUTE_RE.test(p);
1602
1602
  };
1603
1603
  //#endregion
1604
- //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_cf06651230fa8e4c6e2eddd3c1abf6a9/node_modules/vitest/dist/chunks/source-map.DdKI5IHB.js
1604
+ //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_5800036d204cd94ebff73363fb6967a0/node_modules/vitest/dist/chunks/source-map.DdKI5IHB.js
1605
1605
  var build = {};
1606
1606
  var hasRequiredBuild;
1607
1607
  function requireBuild() {
@@ -2279,13 +2279,13 @@ function getOriginalPosition(map, needle) {
2279
2279
  return result;
2280
2280
  }
2281
2281
  //#endregion
2282
- //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_cf06651230fa8e4c6e2eddd3c1abf6a9/node_modules/vitest/dist/task-utils.js
2282
+ //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_5800036d204cd94ebff73363fb6967a0/node_modules/vitest/dist/task-utils.js
2283
2283
  /* @__NO_SIDE_EFFECTS__ */
2284
2284
  function createTaskName(names, separator = " > ") {
2285
2285
  return names.filter((name) => name !== void 0).join(separator);
2286
2286
  }
2287
2287
  //#endregion
2288
- //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_cf06651230fa8e4c6e2eddd3c1abf6a9/node_modules/vitest/dist/chunks/run.Cm2sd7-x.js
2288
+ //#region ../../node_modules/.pnpm/vitest@5.0.4_@types+node@24.19.2_@vitest+browser-playwright@5.0.4_@vitest+ui@5.0.4_jsdo_5800036d204cd94ebff73363fb6967a0/node_modules/vitest/dist/chunks/run.Cm2sd7-x.js
2289
2289
  const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
2290
2290
  plugins.Error;
2291
2291
  var PendingError = class extends Error {
@@ -6797,7 +6797,7 @@ function use(fn) {
6797
6797
  }
6798
6798
  __name(use, "use");
6799
6799
  //#endregion
6800
- //#region ../../node_modules/.pnpm/vite@8.3.4_@types+node@24.19.2_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.1/node_modules/vite/dist/node/module-runner.js
6800
+ //#region ../../node_modules/.pnpm/vite@8.3.4_@types+node@24.19.2_esbuild@0.28.2_jiti@2.7.0_sass-embedded@1.104.1_sass@1.104.1_yaml@2.9.1/node_modules/vite/dist/node/module-runner.js
6801
6801
  let SOURCEMAPPING_URL = "sourceMa";
6802
6802
  SOURCEMAPPING_URL += "ppingURL";
6803
6803
  typeof process < "u" && process.platform;
@@ -664,7 +664,7 @@ function createDomEnv({ scope, anchor, modality, platform, partName, anatomyName
664
664
  const own = normalize(el.textContent);
665
665
  return typeof text === "string" ? own === text : text.test(own);
666
666
  };
667
- const found = Array.from(within.querySelectorAll("*")).filter(matches);
667
+ const found = Array.from(within.querySelectorAll("*")).filter((el) => matches(el) && !el.closest("[hidden]:not([hidden=\"until-found\"])"));
668
668
  return found.filter((el) => !found.some((other) => other !== el && el.contains(other)));
669
669
  };
670
670
  const anchorEls = () => queryBy(anchor, options.root ?? doc());
package/dist/dom.mjs CHANGED
@@ -1 +1 @@
1
- export { t as domEnv } from "./dom-D9Da5Fku.mjs";
1
+ export { t as domEnv } from "./dom-BhoJNuBH.mjs";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as isEnvFactory, i as hostedPartName, n as UntilTimeout, o as mirror } from "./compose-m76ER6GL.mjs";
2
- import { a as navigationLog, i as interceptNativeNavigation, n as installErrorLog, o as installAnnouncementLog, r as fakeRouter, s as recordingAnnouncer, t as domEnv } from "./dom-D9Da5Fku.mjs";
2
+ import { a as navigationLog, i as interceptNativeNavigation, n as installErrorLog, o as installAnnouncementLog, r as fakeRouter, s as recordingAnnouncer, t as domEnv } from "./dom-BhoJNuBH.mjs";
3
3
  import { n as playwrightEnv, r as watchPageErrors, t as isPage } from "./playwright-D79Husn_.mjs";
4
4
  import { accordionContract, alertContract, alertDialogRoleContract, avatarContract, badgeContract, breadcrumbsContract, buttonContract, calendarContract, checkboxContract, checkboxGroupContract, clipboardContract, codeBlockContract, collapsibleContract, colorPickerContract, comboboxContract, contextMenuContract, createService, dateFieldContract, dateRangeFieldContract, dialogContract, drawerContract, fieldContract, fieldsetContract, fileUploadContract, formContract, gridListContract, headingContract, hoverCardContract, imageContract, imageCropperContract, imageViewerContract, inlineComboboxContract, kbdContract, labelContract, linkContract, listboxContract, marqueeContract, menuContract, menubarContract, menubarMenuContract, messageThreadContract, meterContract, modalPopoverContract, modalTourContract, navigationMenuContract, nonModalContextMenuContract, nonModalDialogContract, nonModalDrawerContract, nonModalMenuContract, nonModalMenubarMenuContract, numberInputContract, paginationContract, pinInputContract, platforms, platforms as platforms$1, popoverContract, progressContract, promptInputContract, qrCodeContractWith, quirkActive, radioGroupContract, ratingContract, reasoningContract, scrollAreaContract, segmentedControlContract, selectContract, separatorContract, separatorContractFor, skeletonContract, sliderContract, sortableContract, splitterContract, stepperContract, streamingMessageContract, switchContract, tableContract, tableOfContentsContract, tabsContract, tagGroupContract, tagsInputContract, textFieldContract, timelineContract, toastContract, toasterContract, toggleContract, toggleGroupContract, toolbarContract, tooltipContract, tourContract, treeViewContract, withEngine, withEngine as withEngine$1 } from "@rind-ui/core";
5
5
  import { parseQrPath } from "@rind-ui/core/qr";
@@ -101,6 +101,11 @@ function missingAriaLines(actual, expected) {
101
101
  /** Attributes whose values may contain generated ids (a toolbar control's key is its id, a radio group's default name holds its instance). */
102
102
  const ID_REFS = /^(id|for|name|data-key|aria-(labelledby|describedby|controls|owns|activedescendant|details|errormessage|flowto))$/;
103
103
  /**
104
+ * The frameworks' generated ids (React's useId, Vue's useId and an app prefix, Svelte's
105
+ * `$props.id()`): an item keyed by one (`data-value`, no value given) differs only in it.
106
+ */
107
+ const GENERATED = /^(?:_[rR]_[0-9a-zA-Z]+_|[«:][rR][0-9a-zA-Z]+[»:]|v-\d+|parity\d+-\d+|[cs]\d+)$/;
108
+ /**
104
109
  * A canonical rendering of `html` (or of `node`'s children): comments and whitespace-only text
105
110
  * dropped, adjacent texts joined, attributes sorted, styles normalised by the browser's CSS
106
111
  * serialiser; every element id becomes `@0`, `@1`… (in document order) wherever an id or an ARIA
@@ -125,16 +130,23 @@ function canonicalHtml(html) {
125
130
  const order = [...instances].sort((a, b) => b.length - a.length);
126
131
  const inInstance = (value) => order.reduce((v, id) => v.split(id).join(`#${instances.indexOf(id)}`), value);
127
132
  const ids = (value) => value.split(" ").map((token) => elementIds.includes(token) ? `@${elementIds.indexOf(token)}` : inInstance(token)).join(" ");
133
+ const anchorNames = [];
134
+ const anchors = (value) => value.replace(/--rind-anchor-[^\s;,)]+/g, (name) => {
135
+ if (!anchorNames.includes(name)) anchorNames.push(name);
136
+ return `--rind-anchor-${anchorNames.indexOf(name)}`;
137
+ });
138
+ const declaration = (p, value) => p === "--rind-anchor-id" ? inInstance(value) : anchors(whole(value));
139
+ const whole = (value) => value.replace(/-?\d+\.\d+px/g, (n) => `${Math.round(Number.parseFloat(n))}px`);
128
140
  const out = [];
129
141
  const walk = (node, depth) => {
130
142
  const pad = " ".repeat(depth);
131
143
  if (!(node instanceof Element)) return;
132
- const attrs = Array.from(node.attributes).filter(({ name }) => name !== "data-hover" && name !== "data-hovering").map(({ name, value }) => {
144
+ const attrs = Array.from(node.attributes).filter(({ name }) => name !== "data-hover" && name !== "data-hovering").filter(({ name }) => name !== "style" || node.style.length > 0).map(({ name, value }) => {
133
145
  if (name === "style") {
134
146
  const style = node.style;
135
- return `style="${Array.from({ length: style.length }, (_, i) => style.item(i)).sort().map((p) => `${p}: ${style.getPropertyValue(p)}`).join("; ")}"`;
147
+ return `style="${Array.from({ length: style.length }, (_, i) => style.item(i)).sort().map((p) => `${p}: ${declaration(p, style.getPropertyValue(p))}`).join("; ")}"`;
136
148
  }
137
- return `${name}="${name === "data-instance" ? inInstance(value) : ID_REFS.test(name) ? ids(value) : value}"`;
149
+ return `${name}="${name === "data-instance" ? inInstance(value) : ID_REFS.test(name) ? ids(value) : name === "data-value" && GENERATED.test(value) ? "~generated" : value}"`;
138
150
  }).sort();
139
151
  out.push(`${pad}<${node.tagName.toLowerCase()}${attrs.length ? ` ${attrs.join(" ")}` : ""}>`);
140
152
  children(node, depth + 1);
@@ -3275,7 +3287,16 @@ const hiddenFocus = (f) => {
3275
3287
  */
3276
3288
  /** A layer with no restore target part: focus returns to what had it when it opened. */
3277
3289
  const restoresToPrevious = (f) => f.semantics["finalFocus"] === void 0 && f.semantics["trigger"] === void 0;
3278
- const focusKept = (f) => !(restoresToPrevious(f) && f.atInitial && f.baseline.focus.onBody && f.after.focus.onBody) && f.before?.focus.inInstance && !f.after.focus.inInstance && (f.after.focus.onBody || f.from === null || f.from === f.state) ? [`focus left the component (now ${f.after.focus.onBody ? "<body>" : f.after.focus.element?.describe})`] : [];
3290
+ /**
3291
+ * An in-page link (`href="#id"`) moving focus to its target: native link semantics (a Table of
3292
+ * Contents' keyboard follow), not focus lost.
3293
+ */
3294
+ const toLinkTarget = (f) => {
3295
+ const href = f.before?.focus.element?.attrs["href"];
3296
+ const id = f.after.focus.element?.attrs["id"];
3297
+ return href !== void 0 && id !== void 0 && href === `#${id}`;
3298
+ };
3299
+ const focusKept = (f) => !(restoresToPrevious(f) && f.atInitial && f.baseline.focus.onBody && f.after.focus.onBody) && f.before?.focus.inInstance && !f.after.focus.inInstance && !toLinkTarget(f) && (f.after.focus.onBody || f.from === null || f.from === f.state) ? [`focus left the component (now ${f.after.focus.onBody ? "<body>" : f.after.focus.element?.describe})`] : [];
3279
3300
  /** (23) No live region of its own unless the contract declares `live-region`. */
3280
3301
  const liveRegions = (f) => f.traits.includes("live-region") ? [] : f.after.liveRegions.map((r) => `${r} is a live region; announce through the Announcer`);
3281
3302
  /**
package/dist/setup.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as navigationLog, n as installErrorLog, o as installAnnouncementLog } from "./dom-D9Da5Fku.mjs";
1
+ import { a as navigationLog, n as installErrorLog, o as installAnnouncementLog } from "./dom-BhoJNuBH.mjs";
2
2
  //#region src/setup.ts
3
3
  function define(target, name, value) {
4
4
  if (!target || Reflect.get(target, name) != null) return;
@@ -99,7 +99,7 @@ async function runnerAfterEach() {
99
99
  const global = g["afterEach"];
100
100
  if (typeof global === "function") return global;
101
101
  try {
102
- return (await import("./dist-DGqRlido.mjs")).afterEach ?? null;
102
+ return (await import("./dist-Cy4kVOi8.mjs")).afterEach ?? null;
103
103
  } catch {
104
104
  return null;
105
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rind-ui/testing",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Test drivers and environment setup for rind-ui components (Testing Library and Playwright).",
5
5
  "license": "MIT",
6
6
  "author": "Watermelon Bros",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "dom-accessibility-api": "^0.7.1",
59
- "@rind-ui/core": "1.1.0"
59
+ "@rind-ui/core": "1.2.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@internationalized/date": "^3.12.4",
@@ -66,7 +66,7 @@
66
66
  "react": "^19.3.0",
67
67
  "react-dom": "^19.3.0",
68
68
  "rolldown": "1.2.13",
69
- "@rind-ui/react": "1.1.0"
69
+ "@rind-ui/react": "1.2.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@testing-library/dom": ">=10",