@@ -114,14 +114,35 @@ it directly.
114
114
115
115
It takes the following props:
116
116
117
- - ` searchParams ` : The initial search params to use for the test. These can be a
117
+ - ` searchParams{:ts} ` : The initial search params to use for the test. These can be a
118
118
query string, a ` URLSearchParams ` object or a record object with string values.
119
119
120
120
``` tsx
121
+ import { NuqsTestingAdapter } from ' nuqs/adapters/testing'
122
+
121
123
<NuqsTestingAdapter searchParams = " ?q=hello&limit=10" >
122
124
<NuqsTestingAdapter searchParams = { new URLSearchParams (" ?q=hello&limit=10" )} >
123
125
<NuqsTestingAdapter searchParams = { {
124
126
q: ' hello' ,
125
127
limit: ' 10' // Values are serialized strings
126
128
}} >
127
129
```
130
+
131
+ - `onUrlUpdate{ :ts } `, a function that will be called when the URL is updated
132
+ by the component. It receives an object with:
133
+ - the new search params as an instance of `URLSearchParams{ :ts } `
134
+ - the new querystring (for convenience)
135
+ - the options used to update the URL.
136
+
137
+ <details >
138
+ <summary >🧪 Internal/advanced options</summary >
139
+
140
+ - `rateLimitFactor{ :ts } `. By default, rate limiting is disabled when testing,
141
+ as it can lead to unexpected behaviours. Setting this to 1 will enable rate
142
+ limiting with the same factor as in production.
143
+
144
+ - `resetUrlUpdateQueueOnMount{ :ts } `: clear the URL update queue before running the test.
145
+ This is `true{ :ts } ` by default to isolate tests, but you can set it to `false{ :ts } ` to keep the
146
+ URL update queue between renders and match the production behaviour more closely.
147
+
148
+ </details >
0 commit comments