@servicetitan/docs-anvil-uikit-contrib 36.0.0 → 37.0.1

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.
@@ -12,16 +12,18 @@ When it isn't practical to [mock the API service classes](/docs/frontend/testing
12
12
  ### Examples
13
13
 
14
14
  <Tabs
15
- defaultValue="jest"
16
- values={[
17
- { label: 'Jest (default)', value: 'jest' },
18
- { label: 'Vitest', value: 'vitest' },
19
- { label: 'Storybook', value: 'storybook' },
20
- ]}
15
+ defaultValue="jest"
16
+ values={[
17
+ { label: 'Jest (default)', value: 'jest' },
18
+ { label: 'Vitest', value: 'vitest' },
19
+ { label: 'Storybook', value: 'storybook' },
20
+ ]}
21
21
  >
22
22
  <TabItem value="jest">
23
23
 
24
24
  ```ts
25
+ import { MockApiCalls } from '@servicetitan/testing-library';
26
+
25
27
  describe('[admin] AppRoutes', () => {
26
28
  // Create helper to mock API calls
27
29
  const apiResponses = new MockApiCalls();
@@ -42,10 +44,10 @@ describe('[admin] AppRoutes', () => {
42
44
  </TabItem>
43
45
  <TabItem value="vitest">
44
46
 
45
- For Vitest tests, import from the `/vitest` entry point:
47
+ When using Vitest, import from the `/vitest` entry point:
46
48
 
47
49
  ```ts
48
- import { MockApiCalls } from '@servicetitan/testing-library/vitest';
50
+ import { MockApiCalls } from '@servicetitan/testing-library/vitest'; // Import from /vitest
49
51
  import { describe, it, expect, beforeEach } from 'vitest';
50
52
 
51
53
  describe('[admin] AppRoutes', () => {
@@ -72,7 +74,7 @@ describe('[admin] AppRoutes', () => {
72
74
  For use in Storybook stories or other contexts without Jest or Vitest, import from the `/mock-api-calls` entry point:
73
75
 
74
76
  ```ts
75
- import { MockApiCalls } from '@servicetitan/testing-library/mock-api-calls';
77
+ import { MockApiCalls } from '@servicetitan/testing-library/mock-api-calls'; // Import from /mock-api-calls
76
78
  import type { Meta, StoryObj } from '@storybook/react';
77
79
 
78
80
  const meta: Meta<typeof MyComponent> = {
@@ -2,17 +2,43 @@
2
2
  title: Queries
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  Testing Library includes custom [queries](https://testing-library.com/docs/queries/about) that find elements with ServiceTitan specific attributes.
6
9
 
7
10
  ## Usage
8
11
 
9
12
  To use custom queries, import them from Testing Library and merge them with the default set of queries attached to rendered components.
10
13
 
14
+ <Tabs defaultValue="jest"
15
+ values={[
16
+ { label: 'Jest (default)', value: 'jest' },
17
+ { label: 'Vitest', value: 'vitest'},
18
+ ]}>
19
+ <TabItem value="jest">
20
+
11
21
  ```ts
12
22
  import { queries, render } from '@testing-library/react'; // Import default queries
13
23
  import { queries as customQueries } from '@servicetitan/testing-library'; // Import custom queries
14
24
 
15
- // ...
25
+ const subject = () => {
26
+ return render(
27
+ <MyComponent />,
28
+ // Merge custom queries with defaults
29
+ { queries: { ...queries, ...customQueries } }
30
+ );
31
+ };
32
+ ```
33
+
34
+ </TabItem>
35
+ <TabItem value="vitest">
36
+
37
+ When using Vitest, import from the `/vitest` entry point:
38
+
39
+ ```ts
40
+ import { queries, render } from '@testing-library/react'; // Import default queries
41
+ import { queries as customQueries } from '@servicetitan/testing-library/vitest'; // Import from /vitest
16
42
 
17
43
  const subject = () => {
18
44
  return render(
@@ -23,6 +49,9 @@ const subject = () => {
23
49
  };
24
50
  ```
25
51
 
52
+ </TabItem>
53
+ </Tabs>
54
+
26
55
  ## ByAnvilComponentName
27
56
 
28
57
  > getByAnvilComponentName, queryByAnvilComponentName, getAllByAnvilComponentName, queryAllByAnvilComponentName, findByAnvilComponentName, findAllByAnvilComponentName
@@ -2,6 +2,38 @@
2
2
  title: Matchers
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
8
+ Testing library includes several [custom matchers](https://jestjs.io/docs/using-matchers).
9
+
10
+ ## Usage
11
+
12
+ To register matchers import the library into tests, or into the global setup:
13
+
14
+ <Tabs defaultValue="jest"
15
+ values={[
16
+ { label: 'Jest (default)', value: 'jest' },
17
+ { label: 'Vitest', value: 'vitest'},
18
+ ]}>
19
+ <TabItem value="jest">
20
+
21
+ ```ts
22
+ import '@servicetitan/testing-library';
23
+ ```
24
+
25
+ </TabItem>
26
+ <TabItem value="vitest">
27
+
28
+ When using Vitest, import from the `/vitest` entry point:
29
+
30
+ ```ts
31
+ import '@servicetitan/testing-library/vitest';
32
+ ```
33
+
34
+ </TabItem>
35
+ </Tabs>
36
+
5
37
  ## toBeWithinRange
6
38
 
7
39
  Checks whether a value equals another value, plus or minus the specified delta.
@@ -18,3 +18,11 @@ This library has `peerDependencies` for:
18
18
  - `@testing-library/react`: >=12.0.0
19
19
  - `@testing-library/react-hooks`: >=7.0.0 (only if using `@testing-library/react` v12)
20
20
  - `react`: >=17.0.0
21
+
22
+ ## Using with Vitest
23
+
24
+ When using Vitest, import from the `/vitest` entry point:
25
+
26
+ ```ts
27
+ import '@servicetitan/testing-library/vitest';
28
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-anvil-uikit-contrib",
3
- "version": "36.0.0",
3
+ "version": "37.0.1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,5 +16,5 @@
16
16
  "cli": {
17
17
  "webpack": false
18
18
  },
19
- "gitHead": "aafdfc3cb503509159642338517d94ca7f5c672b"
19
+ "gitHead": "213d4ed9274374a6298922722230cea746f815c9"
20
20
  }