Skip to content

Commit 590211b

Browse files
committed
fix: use Vue Router in abstract mode
Fixes testing-library#210
1 parent 4efca8a commit 590211b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/__tests__/vue-router.js

+6
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ test('setting initial route', () => {
3232

3333
expect(getByTestId('location-display')).toHaveTextContent('/about')
3434
})
35+
36+
test('router state is not shared between tests', () => {
37+
const {getByTestId} = render(App, {routes})
38+
39+
expect(getByTestId('location-display')).toHaveTextContent('/')
40+
})

src/render.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function render(
3939
const VueRouter = requiredRouter.default || requiredRouter
4040
localVue.use(VueRouter)
4141

42-
router = new VueRouter({routes})
42+
router = new VueRouter({routes, mode: 'abstract'})
43+
router.push('/')
4344
}
4445

4546
if (configurationCb && typeof configurationCb === 'function') {

0 commit comments

Comments
 (0)