name: undefined,
},
},
+ notFound: {
+ string: '/not-found',
+ normalized: {
+ fullPath: '/not-found',
+ path: '/not-found',
+ params: {},
+ meta: {},
+ query: {},
+ hash: '',
+ matched: [],
+ redirectedFrom: undefined,
+ name: undefined,
+ },
+ },
}
describe('RouterLink', () => {
expect(el.querySelector('a')!.className).toContain('nav-item')
})
+ it('is not active on a non matched location', () => {
+ const { el } = factory(
+ locations.notFound.normalized,
+ { to: locations.basic.string },
+ locations.basic.normalized
+ )
+ expect(el.querySelector('a')!.className).toBe('')
+ })
+
it('is not active with more repeated params', () => {
const { el } = factory(
locations.repeatedParams2.normalized,
)
const isExactActive = computed<boolean>(
() =>
+ activeRecordIndex.value > -1 &&
activeRecordIndex.value === currentRoute.value.matched.length - 1 &&
isSameLocationObject(currentRoute.value.params, route.value.params)
)