@noma.to/qwik-testing-library 1.0.4 → 1.1.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 (100) hide show
  1. package/README.md +61 -0
  2. package/lib/_virtual/_commonjsHelpers.qwik.cjs +2 -0
  3. package/lib/_virtual/_commonjsHelpers.qwik.mjs +2 -0
  4. package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +4 -0
  5. package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +4 -0
  6. package/lib/index.qwik.cjs +4 -0
  7. package/lib/index.qwik.mjs +4 -0
  8. package/lib/lib/mock.qwik.cjs +14 -0
  9. package/lib/lib/mock.qwik.mjs +14 -0
  10. package/lib/lib/qwik-testing-library.qwik.cjs +4 -0
  11. package/lib/lib/qwik-testing-library.qwik.mjs +4 -0
  12. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +425 -0
  13. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +425 -0
  14. package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.cjs +1967 -0
  15. package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.mjs +1967 -0
  16. package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +1202 -0
  17. package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +1202 -0
  18. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +44 -0
  19. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +44 -0
  20. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.cjs +665 -0
  21. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.mjs +665 -0
  22. package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.cjs +1641 -0
  23. package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.mjs +1641 -0
  24. package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.cjs +148 -0
  25. package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.mjs +148 -0
  26. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs +158 -0
  27. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs +158 -0
  28. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.cjs +1731 -0
  29. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.mjs +1731 -0
  30. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.cjs +137 -0
  31. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.mjs +137 -0
  32. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.cjs +150 -0
  33. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.mjs +150 -0
  34. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +81 -0
  35. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +81 -0
  36. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.cjs +216 -0
  37. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.mjs +216 -0
  38. package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.cjs +3905 -0
  39. package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.mjs +3905 -0
  40. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.cjs +9 -0
  41. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.mjs +10 -0
  42. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.cjs +16 -0
  43. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.mjs +17 -0
  44. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.cjs +9 -0
  45. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.mjs +10 -0
  46. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.cjs +16 -0
  47. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.mjs +17 -0
  48. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.cjs +12 -0
  49. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.mjs +13 -0
  50. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.cjs +30 -0
  51. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.mjs +31 -0
  52. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.cjs +11 -0
  53. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.mjs +12 -0
  54. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.cjs +160 -0
  55. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.mjs +160 -0
  56. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.cjs +36 -0
  57. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.mjs +36 -0
  58. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.cjs +130 -0
  59. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.mjs +130 -0
  60. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.cjs +25 -0
  61. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.mjs +26 -0
  62. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.cjs +19 -0
  63. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.mjs +20 -0
  64. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.cjs +24 -0
  65. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.mjs +25 -0
  66. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.cjs +17 -0
  67. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.mjs +18 -0
  68. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.cjs +9 -0
  69. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.mjs +10 -0
  70. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.cjs +16 -0
  71. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.mjs +17 -0
  72. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.cjs +24 -0
  73. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.mjs +25 -0
  74. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.cjs +8 -0
  75. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.mjs +9 -0
  76. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.cjs +34 -0
  77. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.mjs +35 -0
  78. package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.cjs +968 -0
  79. package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.mjs +968 -0
  80. package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs +101 -0
  81. package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs +101 -0
  82. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +7 -0
  83. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +8 -0
  84. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +80 -0
  85. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +80 -0
  86. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +104 -0
  87. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +104 -0
  88. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +8 -0
  89. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +8 -0
  90. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +6 -0
  91. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +6 -0
  92. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +56 -0
  93. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +56 -0
  94. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +16 -0
  95. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +16 -0
  96. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +2556 -0
  97. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +2556 -0
  98. package/lib-types/lib/mock.d.ts +34 -0
  99. package/lib-types/lib/qwik-testing-library.d.ts +2 -1
  100. package/package.json +5 -4
package/README.md CHANGED
@@ -92,6 +92,7 @@ src="https://raw.githubusercontent.com/ianlet/qwik-testing-library/main/high-vol
92
92
  - [Setup](#setup)
93
93
  - [Examples](#examples)
94
94
  - [Qwikstart](#qwikstart)
95
+ - [Mocking Component Callbacks (experimental)](#mocking-component-callbacks-experimental)
95
96
  - [Qwik City - `server$` calls](#qwik-city---server-calls)
96
97
  - [Gotchas](#gotchas)
97
98
  - [Issues](#issues)
@@ -279,6 +280,8 @@ This is a minimal setup to get you started, with line-by-line explanations.
279
280
 
280
281
  // import qwik-testing methods
281
282
  import {screen, render, waitFor} from "@noma.to/qwik-testing-library";
283
+ // import the userEvent methods to interact with the DOM
284
+ import {userEvent} from "@testing-library/user-event";
282
285
  // import the component to be tested
283
286
  import {Counter} from "./counter";
284
287
 
@@ -301,6 +304,64 @@ describe("<Counter />", () => {
301
304
  })
302
305
  ```
303
306
 
307
+ ### Mocking Component Callbacks (experimental)
308
+
309
+ > [!WARNING]
310
+ > This feature is under a testing phase and thus experimental.
311
+ > Its API may change in the future, so use it at your own risk.
312
+
313
+ The Qwik Testing Library provides a `mock$` function
314
+ that can be used to create a mock of a QRL and verify interactions on your Qwik components.
315
+
316
+ It is _not_ a replacement of regular mocking functions (such as `vi.fn` and `vi.mock`) as its intended use is only for
317
+ testing callbacks of Qwik components.
318
+
319
+ Here's an example on how to use the `mock$` function:
320
+
321
+ ```tsx title="counter.spec.tsx"
322
+ // import qwik-testing methods
323
+ import {mock$, clearAllMock, render, screen, waitFor} from "@noma.to/qwik-testing-library";
324
+ // import the userEvent methods to interact with the DOM
325
+ import userEvent from "@testing-library/user-event";
326
+
327
+ // import the component to be tested
328
+ import {Counter} from "./counter";
329
+
330
+ // describe the test suite
331
+ describe("<Counter />", () => {
332
+ // initialize a mock
333
+ // note: the empty callback is required but currently unused
334
+ const onChangeMock = mock$(() => {
335
+ });
336
+
337
+ // setup beforeEach block to run before each test
338
+ beforeEach(() => {
339
+ // remember to always clear all mocks before each test
340
+ clearAllMocks();
341
+ });
342
+
343
+ // describe the 'on increment' test cases
344
+ describe("on increment", () => {
345
+ // describe the test case
346
+ it("should call onChange$", async () => {
347
+ // render the component into the DOM
348
+ await render(<Counter value={0} onChange$={onChangeMock}/>);
349
+
350
+ // retrieve the 'decrement' button
351
+ const decrementBtn = screen.getByRole("button", {name: "Decrement"});
352
+ // click the button
353
+ await userEvent.click(decrementBtn);
354
+
355
+ // assert that the onChange$ callback was called with the right value
356
+ // note: QRLs are async in Qwik, so we need to resolve them to verify interactions
357
+ await waitFor(() =>
358
+ expect(onChangeMock.resolve()).resolves.toHaveBeenCalledWith(-1),
359
+ );
360
+ });
361
+ });
362
+ })
363
+ ```
364
+
304
365
  ### Qwik City - `server$` calls
305
366
 
306
367
  If one of your Qwik components uses `server$` calls, your tests might fail with a rather cryptic message (e.g. `QWIK
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3
4
  function getDefaultExportFromCjs(x) {
4
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
6
  }
7
+ exports.commonjsGlobal = commonjsGlobal;
6
8
  exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
@@ -1,6 +1,8 @@
1
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1
2
  function getDefaultExportFromCjs(x) {
2
3
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3
4
  }
4
5
  export {
6
+ commonjsGlobal,
5
7
  getDefaultExportFromCjs
6
8
  };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var sourcemapCodec_umd = { exports: {} };
4
+ exports.__module = sourcemapCodec_umd;
@@ -0,0 +1,4 @@
1
+ var sourcemapCodec_umd = { exports: {} };
2
+ export {
3
+ sourcemapCodec_umd as __module
4
+ };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const qwikTestingLibrary = require("./lib/qwik-testing-library.qwik.cjs");
4
4
  const index = require("./node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.qwik.cjs");
5
5
  const dom_esm = require("./node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.cjs");
6
+ const mock = require("./lib/mock.qwik.cjs");
6
7
  exports.cleanup = qwikTestingLibrary.cleanup;
7
8
  exports.render = qwikTestingLibrary.render;
8
9
  exports.prettyFormat = index;
@@ -83,3 +84,6 @@ exports.waitForElementToBeRemoved = dom_esm.waitForElementToBeRemoved;
83
84
  exports.within = dom_esm.getQueriesForElement;
84
85
  exports.wrapAllByQueryWithSuggestion = dom_esm.wrapAllByQueryWithSuggestion;
85
86
  exports.wrapSingleQueryWithSuggestion = dom_esm.wrapSingleQueryWithSuggestion;
87
+ exports.clearAllMocks = mock.clearAllMocks;
88
+ exports.mock$ = mock.mock$;
89
+ exports.mockQrl = mock.mockQrl;
@@ -1,9 +1,11 @@
1
1
  import { cleanup, render } from "./lib/qwik-testing-library.qwik.mjs";
2
2
  import * as index from "./node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.qwik.mjs";
3
3
  import { buildQueries, configure, createEvent, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getMultipleElementsFoundError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, makeFindQuery, makeGetAllQuery, makeSingleQuery, prettyDOM, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, waitFor, waitForElementToBeRemoved, getQueriesForElement as getQueriesForElement2, wrapAllByQueryWithSuggestion, wrapSingleQueryWithSuggestion } from "./node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.mjs";
4
+ import { clearAllMocks, mock$, mockQrl } from "./lib/mock.qwik.mjs";
4
5
  export {
5
6
  buildQueries,
6
7
  cleanup,
8
+ clearAllMocks,
7
9
  configure,
8
10
  createEvent,
9
11
  findAllByAltText,
@@ -53,6 +55,8 @@ export {
53
55
  makeFindQuery,
54
56
  makeGetAllQuery,
55
57
  makeSingleQuery,
58
+ mock$,
59
+ mockQrl,
56
60
  prettyDOM,
57
61
  index as prettyFormat,
58
62
  queries,
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const qwik = require("@builder.io/qwik");
4
+ const vi_D6IHiKAI = require("../node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs");
5
+ const mockQrl = () => {
6
+ return qwik.$(vi_D6IHiKAI.v.fn());
7
+ };
8
+ const mock$ = qwik.implicit$FirstArg(mockQrl);
9
+ function clearAllMocks() {
10
+ vi_D6IHiKAI.v.clearAllMocks();
11
+ }
12
+ exports.clearAllMocks = clearAllMocks;
13
+ exports.mock$ = mock$;
14
+ exports.mockQrl = mockQrl;
@@ -0,0 +1,14 @@
1
+ import { implicit$FirstArg, $ } from "@builder.io/qwik";
2
+ import { v as vi } from "../node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs";
3
+ const mockQrl = () => {
4
+ return $(vi.fn());
5
+ };
6
+ const mock$ = implicit$FirstArg(mockQrl);
7
+ function clearAllMocks() {
8
+ vi.clearAllMocks();
9
+ }
10
+ export {
11
+ clearAllMocks,
12
+ mock$,
13
+ mockQrl
14
+ };
@@ -25,6 +25,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
25
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
26
26
  const dom_esm = require("../node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.cjs");
27
27
  const qwikloader = require("./qwikloader.qwik.cjs");
28
+ const mock = require("./mock.qwik.cjs");
28
29
  const mountedContainers = /* @__PURE__ */ new Set();
29
30
  async function render(ui, options = {}) {
30
31
  const qwik = await import("@builder.io/qwik");
@@ -155,5 +156,8 @@ exports.waitForElementToBeRemoved = dom_esm.waitForElementToBeRemoved;
155
156
  exports.within = dom_esm.getQueriesForElement;
156
157
  exports.wrapAllByQueryWithSuggestion = dom_esm.wrapAllByQueryWithSuggestion;
157
158
  exports.wrapSingleQueryWithSuggestion = dom_esm.wrapSingleQueryWithSuggestion;
159
+ exports.clearAllMocks = mock.clearAllMocks;
160
+ exports.mock$ = mock.mock$;
161
+ exports.mockQrl = mock.mockQrl;
158
162
  exports.cleanup = cleanup;
159
163
  exports.render = render;
@@ -2,6 +2,7 @@ import { jsx } from "@builder.io/qwik/jsx-runtime";
2
2
  import { prettyDOM, getQueriesForElement } from "../node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.mjs";
3
3
  import { buildQueries, configure, createEvent, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getMultipleElementsFoundError, getNodeText, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, makeFindQuery, makeGetAllQuery, makeSingleQuery, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, waitFor, waitForElementToBeRemoved, wrapAllByQueryWithSuggestion, wrapSingleQueryWithSuggestion } from "../node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.mjs";
4
4
  import { qwikLoader } from "./qwikloader.qwik.mjs";
5
+ import { clearAllMocks, mock$, mockQrl } from "./mock.qwik.mjs";
5
6
  const mountedContainers = /* @__PURE__ */ new Set();
6
7
  async function render(ui, options = {}) {
7
8
  const qwik = await import("@builder.io/qwik");
@@ -58,6 +59,7 @@ function cleanup() {
58
59
  export {
59
60
  buildQueries,
60
61
  cleanup,
62
+ clearAllMocks,
61
63
  configure,
62
64
  createEvent,
63
65
  findAllByAltText,
@@ -107,6 +109,8 @@ export {
107
109
  makeFindQuery,
108
110
  makeGetAllQuery,
109
111
  makeSingleQuery,
112
+ mock$,
113
+ mockQrl,
110
114
  prettyDOM,
111
115
  queries,
112
116
  queryAllByAltText,
@@ -0,0 +1,425 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const _commonjsHelpers = require("../../../../../../../_virtual/_commonjsHelpers.qwik.cjs");
4
+ const sourcemapCodec_umd = require("../../../../../../../_virtual/sourcemap-codec.umd.qwik.cjs");
5
+ (function(module2, exports2) {
6
+ (function(global, factory) {
7
+ factory(exports2);
8
+ })(_commonjsHelpers.commonjsGlobal, function(exports3) {
9
+ const comma = ",".charCodeAt(0);
10
+ const semicolon = ";".charCodeAt(0);
11
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
12
+ const intToChar = new Uint8Array(64);
13
+ const charToInt = new Uint8Array(128);
14
+ for (let i = 0; i < chars.length; i++) {
15
+ const c = chars.charCodeAt(i);
16
+ intToChar[i] = c;
17
+ charToInt[c] = i;
18
+ }
19
+ function decodeInteger(reader, relative) {
20
+ let value = 0;
21
+ let shift = 0;
22
+ let integer = 0;
23
+ do {
24
+ const c = reader.next();
25
+ integer = charToInt[c];
26
+ value |= (integer & 31) << shift;
27
+ shift += 5;
28
+ } while (integer & 32);
29
+ const shouldNegate = value & 1;
30
+ value >>>= 1;
31
+ if (shouldNegate) {
32
+ value = -2147483648 | -value;
33
+ }
34
+ return relative + value;
35
+ }
36
+ function encodeInteger(builder, num, relative) {
37
+ let delta = num - relative;
38
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
39
+ do {
40
+ let clamped = delta & 31;
41
+ delta >>>= 5;
42
+ if (delta > 0)
43
+ clamped |= 32;
44
+ builder.write(intToChar[clamped]);
45
+ } while (delta > 0);
46
+ return num;
47
+ }
48
+ function hasMoreVlq(reader, max) {
49
+ if (reader.pos >= max)
50
+ return false;
51
+ return reader.peek() !== comma;
52
+ }
53
+ const bufLength = 1024 * 16;
54
+ const td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
55
+ decode(buf) {
56
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
57
+ return out.toString();
58
+ }
59
+ } : {
60
+ decode(buf) {
61
+ let out = "";
62
+ for (let i = 0; i < buf.length; i++) {
63
+ out += String.fromCharCode(buf[i]);
64
+ }
65
+ return out;
66
+ }
67
+ };
68
+ class StringWriter {
69
+ constructor() {
70
+ this.pos = 0;
71
+ this.out = "";
72
+ this.buffer = new Uint8Array(bufLength);
73
+ }
74
+ write(v) {
75
+ const { buffer } = this;
76
+ buffer[this.pos++] = v;
77
+ if (this.pos === bufLength) {
78
+ this.out += td.decode(buffer);
79
+ this.pos = 0;
80
+ }
81
+ }
82
+ flush() {
83
+ const { buffer, out, pos } = this;
84
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
85
+ }
86
+ }
87
+ class StringReader {
88
+ constructor(buffer) {
89
+ this.pos = 0;
90
+ this.buffer = buffer;
91
+ }
92
+ next() {
93
+ return this.buffer.charCodeAt(this.pos++);
94
+ }
95
+ peek() {
96
+ return this.buffer.charCodeAt(this.pos);
97
+ }
98
+ indexOf(char) {
99
+ const { buffer, pos } = this;
100
+ const idx = buffer.indexOf(char, pos);
101
+ return idx === -1 ? buffer.length : idx;
102
+ }
103
+ }
104
+ const EMPTY = [];
105
+ function decodeOriginalScopes(input) {
106
+ const { length } = input;
107
+ const reader = new StringReader(input);
108
+ const scopes = [];
109
+ const stack = [];
110
+ let line = 0;
111
+ for (; reader.pos < length; reader.pos++) {
112
+ line = decodeInteger(reader, line);
113
+ const column = decodeInteger(reader, 0);
114
+ if (!hasMoreVlq(reader, length)) {
115
+ const last = stack.pop();
116
+ last[2] = line;
117
+ last[3] = column;
118
+ continue;
119
+ }
120
+ const kind = decodeInteger(reader, 0);
121
+ const fields = decodeInteger(reader, 0);
122
+ const hasName = fields & 1;
123
+ const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];
124
+ let vars = EMPTY;
125
+ if (hasMoreVlq(reader, length)) {
126
+ vars = [];
127
+ do {
128
+ const varsIndex = decodeInteger(reader, 0);
129
+ vars.push(varsIndex);
130
+ } while (hasMoreVlq(reader, length));
131
+ }
132
+ scope.vars = vars;
133
+ scopes.push(scope);
134
+ stack.push(scope);
135
+ }
136
+ return scopes;
137
+ }
138
+ function encodeOriginalScopes(scopes) {
139
+ const writer = new StringWriter();
140
+ for (let i = 0; i < scopes.length; ) {
141
+ i = _encodeOriginalScopes(scopes, i, writer, [0]);
142
+ }
143
+ return writer.flush();
144
+ }
145
+ function _encodeOriginalScopes(scopes, index, writer, state) {
146
+ const scope = scopes[index];
147
+ const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
148
+ if (index > 0)
149
+ writer.write(comma);
150
+ state[0] = encodeInteger(writer, startLine, state[0]);
151
+ encodeInteger(writer, startColumn, 0);
152
+ encodeInteger(writer, kind, 0);
153
+ const fields = scope.length === 6 ? 1 : 0;
154
+ encodeInteger(writer, fields, 0);
155
+ if (scope.length === 6)
156
+ encodeInteger(writer, scope[5], 0);
157
+ for (const v of vars) {
158
+ encodeInteger(writer, v, 0);
159
+ }
160
+ for (index++; index < scopes.length; ) {
161
+ const next = scopes[index];
162
+ const { 0: l, 1: c } = next;
163
+ if (l > endLine || l === endLine && c >= endColumn) {
164
+ break;
165
+ }
166
+ index = _encodeOriginalScopes(scopes, index, writer, state);
167
+ }
168
+ writer.write(comma);
169
+ state[0] = encodeInteger(writer, endLine, state[0]);
170
+ encodeInteger(writer, endColumn, 0);
171
+ return index;
172
+ }
173
+ function decodeGeneratedRanges(input) {
174
+ const { length } = input;
175
+ const reader = new StringReader(input);
176
+ const ranges = [];
177
+ const stack = [];
178
+ let genLine = 0;
179
+ let definitionSourcesIndex = 0;
180
+ let definitionScopeIndex = 0;
181
+ let callsiteSourcesIndex = 0;
182
+ let callsiteLine = 0;
183
+ let callsiteColumn = 0;
184
+ let bindingLine = 0;
185
+ let bindingColumn = 0;
186
+ do {
187
+ const semi = reader.indexOf(";");
188
+ let genColumn = 0;
189
+ for (; reader.pos < semi; reader.pos++) {
190
+ genColumn = decodeInteger(reader, genColumn);
191
+ if (!hasMoreVlq(reader, semi)) {
192
+ const last = stack.pop();
193
+ last[2] = genLine;
194
+ last[3] = genColumn;
195
+ continue;
196
+ }
197
+ const fields = decodeInteger(reader, 0);
198
+ const hasDefinition = fields & 1;
199
+ const hasCallsite = fields & 2;
200
+ const hasScope = fields & 4;
201
+ let callsite = null;
202
+ let bindings = EMPTY;
203
+ let range;
204
+ if (hasDefinition) {
205
+ const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
206
+ definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);
207
+ definitionSourcesIndex = defSourcesIndex;
208
+ range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
209
+ } else {
210
+ range = [genLine, genColumn, 0, 0];
211
+ }
212
+ range.isScope = !!hasScope;
213
+ if (hasCallsite) {
214
+ const prevCsi = callsiteSourcesIndex;
215
+ const prevLine = callsiteLine;
216
+ callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
217
+ const sameSource = prevCsi === callsiteSourcesIndex;
218
+ callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
219
+ callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0);
220
+ callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
221
+ }
222
+ range.callsite = callsite;
223
+ if (hasMoreVlq(reader, semi)) {
224
+ bindings = [];
225
+ do {
226
+ bindingLine = genLine;
227
+ bindingColumn = genColumn;
228
+ const expressionsCount = decodeInteger(reader, 0);
229
+ let expressionRanges;
230
+ if (expressionsCount < -1) {
231
+ expressionRanges = [[decodeInteger(reader, 0)]];
232
+ for (let i = -1; i > expressionsCount; i--) {
233
+ const prevBl = bindingLine;
234
+ bindingLine = decodeInteger(reader, bindingLine);
235
+ bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
236
+ const expression = decodeInteger(reader, 0);
237
+ expressionRanges.push([expression, bindingLine, bindingColumn]);
238
+ }
239
+ } else {
240
+ expressionRanges = [[expressionsCount]];
241
+ }
242
+ bindings.push(expressionRanges);
243
+ } while (hasMoreVlq(reader, semi));
244
+ }
245
+ range.bindings = bindings;
246
+ ranges.push(range);
247
+ stack.push(range);
248
+ }
249
+ genLine++;
250
+ reader.pos = semi + 1;
251
+ } while (reader.pos < length);
252
+ return ranges;
253
+ }
254
+ function encodeGeneratedRanges(ranges) {
255
+ if (ranges.length === 0)
256
+ return "";
257
+ const writer = new StringWriter();
258
+ for (let i = 0; i < ranges.length; ) {
259
+ i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
260
+ }
261
+ return writer.flush();
262
+ }
263
+ function _encodeGeneratedRanges(ranges, index, writer, state) {
264
+ const range = ranges[index];
265
+ const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings } = range;
266
+ if (state[0] < startLine) {
267
+ catchupLine(writer, state[0], startLine);
268
+ state[0] = startLine;
269
+ state[1] = 0;
270
+ } else if (index > 0) {
271
+ writer.write(comma);
272
+ }
273
+ state[1] = encodeInteger(writer, range[1], state[1]);
274
+ const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
275
+ encodeInteger(writer, fields, 0);
276
+ if (range.length === 6) {
277
+ const { 4: sourcesIndex, 5: scopesIndex } = range;
278
+ if (sourcesIndex !== state[2]) {
279
+ state[3] = 0;
280
+ }
281
+ state[2] = encodeInteger(writer, sourcesIndex, state[2]);
282
+ state[3] = encodeInteger(writer, scopesIndex, state[3]);
283
+ }
284
+ if (callsite) {
285
+ const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
286
+ if (sourcesIndex !== state[4]) {
287
+ state[5] = 0;
288
+ state[6] = 0;
289
+ } else if (callLine !== state[5]) {
290
+ state[6] = 0;
291
+ }
292
+ state[4] = encodeInteger(writer, sourcesIndex, state[4]);
293
+ state[5] = encodeInteger(writer, callLine, state[5]);
294
+ state[6] = encodeInteger(writer, callColumn, state[6]);
295
+ }
296
+ if (bindings) {
297
+ for (const binding of bindings) {
298
+ if (binding.length > 1)
299
+ encodeInteger(writer, -binding.length, 0);
300
+ const expression = binding[0][0];
301
+ encodeInteger(writer, expression, 0);
302
+ let bindingStartLine = startLine;
303
+ let bindingStartColumn = startColumn;
304
+ for (let i = 1; i < binding.length; i++) {
305
+ const expRange = binding[i];
306
+ bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
307
+ bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
308
+ encodeInteger(writer, expRange[0], 0);
309
+ }
310
+ }
311
+ }
312
+ for (index++; index < ranges.length; ) {
313
+ const next = ranges[index];
314
+ const { 0: l, 1: c } = next;
315
+ if (l > endLine || l === endLine && c >= endColumn) {
316
+ break;
317
+ }
318
+ index = _encodeGeneratedRanges(ranges, index, writer, state);
319
+ }
320
+ if (state[0] < endLine) {
321
+ catchupLine(writer, state[0], endLine);
322
+ state[0] = endLine;
323
+ state[1] = 0;
324
+ } else {
325
+ writer.write(comma);
326
+ }
327
+ state[1] = encodeInteger(writer, endColumn, state[1]);
328
+ return index;
329
+ }
330
+ function catchupLine(writer, lastLine, line) {
331
+ do {
332
+ writer.write(semicolon);
333
+ } while (++lastLine < line);
334
+ }
335
+ function decode(mappings) {
336
+ const { length } = mappings;
337
+ const reader = new StringReader(mappings);
338
+ const decoded = [];
339
+ let genColumn = 0;
340
+ let sourcesIndex = 0;
341
+ let sourceLine = 0;
342
+ let sourceColumn = 0;
343
+ let namesIndex = 0;
344
+ do {
345
+ const semi = reader.indexOf(";");
346
+ const line = [];
347
+ let sorted = true;
348
+ let lastCol = 0;
349
+ genColumn = 0;
350
+ while (reader.pos < semi) {
351
+ let seg;
352
+ genColumn = decodeInteger(reader, genColumn);
353
+ if (genColumn < lastCol)
354
+ sorted = false;
355
+ lastCol = genColumn;
356
+ if (hasMoreVlq(reader, semi)) {
357
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
358
+ sourceLine = decodeInteger(reader, sourceLine);
359
+ sourceColumn = decodeInteger(reader, sourceColumn);
360
+ if (hasMoreVlq(reader, semi)) {
361
+ namesIndex = decodeInteger(reader, namesIndex);
362
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
363
+ } else {
364
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
365
+ }
366
+ } else {
367
+ seg = [genColumn];
368
+ }
369
+ line.push(seg);
370
+ reader.pos++;
371
+ }
372
+ if (!sorted)
373
+ sort(line);
374
+ decoded.push(line);
375
+ reader.pos = semi + 1;
376
+ } while (reader.pos <= length);
377
+ return decoded;
378
+ }
379
+ function sort(line) {
380
+ line.sort(sortComparator);
381
+ }
382
+ function sortComparator(a, b) {
383
+ return a[0] - b[0];
384
+ }
385
+ function encode(decoded) {
386
+ const writer = new StringWriter();
387
+ let sourcesIndex = 0;
388
+ let sourceLine = 0;
389
+ let sourceColumn = 0;
390
+ let namesIndex = 0;
391
+ for (let i = 0; i < decoded.length; i++) {
392
+ const line = decoded[i];
393
+ if (i > 0)
394
+ writer.write(semicolon);
395
+ if (line.length === 0)
396
+ continue;
397
+ let genColumn = 0;
398
+ for (let j = 0; j < line.length; j++) {
399
+ const segment = line[j];
400
+ if (j > 0)
401
+ writer.write(comma);
402
+ genColumn = encodeInteger(writer, segment[0], genColumn);
403
+ if (segment.length === 1)
404
+ continue;
405
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
406
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
407
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
408
+ if (segment.length === 4)
409
+ continue;
410
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
411
+ }
412
+ }
413
+ return writer.flush();
414
+ }
415
+ exports3.decode = decode;
416
+ exports3.decodeGeneratedRanges = decodeGeneratedRanges;
417
+ exports3.decodeOriginalScopes = decodeOriginalScopes;
418
+ exports3.encode = encode;
419
+ exports3.encodeGeneratedRanges = encodeGeneratedRanges;
420
+ exports3.encodeOriginalScopes = encodeOriginalScopes;
421
+ Object.defineProperty(exports3, "__esModule", { value: true });
422
+ });
423
+ })(sourcemapCodec_umd.__module, sourcemapCodec_umd.__module.exports);
424
+ var sourcemapCodec_umdExports = sourcemapCodec_umd.__module.exports;
425
+ exports.sourcemapCodec_umdExports = sourcemapCodec_umdExports;