MCPcopy
hub / github.com/TanStack/router / runTest

Function runTest

packages/solid-router/tests/link.test.tsx:267–443  ·  view source on GitHub ↗
(opts: { explicitUndefined: boolean | undefined })

Source from the content-addressed store, hash-verified

265
266 describe('when the current route has a search fields with undefined values', () => {
267 async function runTest(opts: { explicitUndefined: boolean | undefined }) {
268 const rootRoute = createRootRoute()
269 const indexRoute = createRoute({
270 getParentRoute: () => rootRoute,
271 path: '/',
272 component: () => {
273 return (
274 <>
275 <h1>Index</h1>
276 <Link
277 to="/"
278 activeOptions={{ exact: true }}
279 inactiveProps={{ class: 'inactive' }}
280 >
281 Index exact
282 </Link>
283 <Link
284 to="/"
285 search={{ foo: undefined }}
286 inactiveProps={{ class: 'inactive' }}
287 activeOptions={{ explicitUndefined: opts.explicitUndefined }}
288 >
289 Index foo=undefined
290 </Link>
291 <Link
292 to="/"
293 search={{ foo: undefined }}
294 activeOptions={{
295 exact: true,
296 explicitUndefined: opts.explicitUndefined,
297 }}
298 inactiveProps={{ class: 'inactive' }}
299 >
300 Index foo=undefined-exact
301 </Link>
302 <Link
303 to="/"
304 search={{ foo: 'bar' }}
305 inactiveProps={{
306 class: 'inactive',
307 }}
308 >
309 Index foo=bar
310 </Link>
311 </>
312 )
313 },
314 })
315
316 const router = createRouter({
317 routeTree: rootRoute.addChildren([indexRoute]),
318 })
319
320 render(() => <RouterProvider router={router} />)
321
322 // round 1
323 const indexExactLink = await screen.findByRole('link', {
324 name: 'Index exact',

Callers 1

link.test.tsxFile · 0.70

Calls 5

createRootRouteFunction · 0.90
createRouteFunction · 0.90
createRouterFunction · 0.90
getRouteApiFunction · 0.90
renderFunction · 0.50

Tested by

no test coverage detected