guardsLength: number = n
) {
beforeRouteEnter.mockClear()
- const guards = await extractComponentsGuards(
+ const guards = extractComponentsGuards(
// type is fine as we excluded RouteRecordRedirect in components argument
components.map(normalizeRouteRecord) as RouteRecordNormalized[],
'beforeRouteEnter',
RouteRecordMultipleViews,
MatcherLocation,
RouteLocationNormalized,
- _RouteRecordBase,
RouteComponent,
RouteRecordRaw,
RouteRecordName,
/**
* creates a component that logs the guards
- * @param name
+ * @param key {string} - a unique identifier for the component
+ * @returns {object} - a Vue component object with beforeRouteEnter, beforeRouteUpdate, and beforeRouteLeave navigation guards implemented
*/
function createTestComponent(key: string) {
return defineComponent({
ref,
watchEffect,
computed,
- toRefs,
defineComponent,
} from 'vue'
const delay = (t: number) => new Promise(r => setTimeout(r, t))
/**
- * creates a component that logs the guards
- * @param name
+ * Creates a test component with the given key, optionally specifying whether it should be async and whether creation should be logged.
+ *
+ * @param {string} key - The key of the component.
+ * @param {boolean} [isAsync=false] - Whether the component should be async.
+ * @param {boolean} [logCreation=false] - Whether creation should be logged.
+ * @returns {object} The component object.
+ *
*/
function createTestComponent(
key: string,
/**
* Creates a normalized history location from a window.location object
- * @param location -
+ * @param base - The base path
+ * @param location - The window.location object
*/
function createCurrentLocation(
base: string,
* pointing towards the same {@link RouteRecord} and that all `params`, `query`
* parameters and `hash` are the same
*
+ * @param stringifyQuery - A function that takes a query object of type LocationQueryRaw and returns a string representation of it.
* @param a - first {@link RouteLocation}
* @param b - second {@link RouteLocation}
*/