Is there a way to run component tests for Vue Router? For example when sombody wants to test if a link is rendered correctly (see test below) or to test if the user can click on a link and is able to navigate to the correct page?
Related to issue: Plugin Mounting Options
ComponentWorksNot.test.ts:
import { test, expect } from '@playwright/experimental-ct-vue';
import ComponentWorksNot from './ComponentWorksNot.vue';
test('renders a link', async ({ mount }) => {
const component = await mount(ComponentWorksNot, {
props: {
test: 'test'
}
});
await expect(component).toHaveAttribute('href', '/'); // fails because RouterLink is not resolved
});
ComponentWorksNot.vue:
<script lang="ts" setup>
import { RouteName } from '../router';
const props = defineProps<{ test: string }>()
</script>
<template>
<RouterLink :to="{ name: RouteName.TEST }">{{ props.test }}</RouterLink>
</template>
Full repo can be viewed here
Is there a way to run component tests for Vue Router? For example when sombody wants to test if a link is rendered correctly (see test below) or to test if the user can click on a link and is able to navigate to the correct page?
Related to issue: Plugin Mounting Options
ComponentWorksNot.test.ts:
ComponentWorksNot.vue:
Full repo can be viewed here