Skip to content

Commit 6fc6e2b

Browse files
committed
ref: switch to data-testId
1 parent 74a3835 commit 6fc6e2b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/react-router/tests/Matches.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ test('when filtering useMatches by loaderData', async () => {
124124

125125
test('should show pendingComponent of root route', async () => {
126126
const root = createRootRoute({
127-
pendingComponent: () => <div>root pending...</div>,
127+
pendingComponent: () => <div data-testId="root-pending" />,
128128
loader: async () => {
129129
await new Promise((r) => setTimeout(r, 50))
130130
},
131-
component: () => 'root content',
131+
component: () => <div data-testId="root-content" />,
132132
})
133133
const router = createRouter({
134134
routeTree: root,
@@ -138,6 +138,6 @@ test('should show pendingComponent of root route', async () => {
138138

139139
const rendered = render(<RouterProvider router={router} />)
140140

141-
expect(await rendered.findByText('root pending...')).toBeInTheDocument()
142-
expect(await rendered.findByText('root content')).toBeInTheDocument()
141+
expect(await rendered.findByTestId('root-pending')).toBeInTheDocument()
142+
expect(await rendered.findByTestId('root-content')).toBeInTheDocument()
143143
})

packages/solid-router/tests/Matches.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@ test('Matches provides InnerWrap context to defaultPendingComponent', async () =
224224

225225
test('should show pendingComponent of root route', async () => {
226226
const root = createRootRoute({
227-
pendingComponent: () => <div>root pending...</div>,
227+
pendingComponent: () => <div data-testId="root-pending" />,
228228
loader: async () => {
229229
await new Promise((r) => setTimeout(r, 50))
230230
},
231-
component: () => 'root content',
231+
component: () => <div data-testId="root-content" />,
232232
})
233233

234234
const router = createRouter({
@@ -239,6 +239,6 @@ test('should show pendingComponent of root route', async () => {
239239

240240
const rendered = render(() => <RouterProvider router={router} />)
241241

242-
expect(await rendered.findByText('root pending...')).toBeInTheDocument()
243-
expect(await rendered.findByText('root content')).toBeInTheDocument()
242+
expect(await rendered.findByTestId('root-pending')).toBeInTheDocument()
243+
expect(await rendered.findByTestId('root-content')).toBeInTheDocument()
244244
})

0 commit comments

Comments
 (0)