From: Eduardo San Martin Morote Date: Tue, 31 Dec 2019 13:48:39 +0000 (+0100) Subject: refactor(router): rename onReady to isReady X-Git-Tag: v4.0.0-alpha.0~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dc91a7c87566f32c2227a2c981137ee0c4cf04d;p=thirdparty%2Fvuejs%2Frouter.git refactor(router): rename onReady to isReady --- diff --git a/__tests__/matcher/path-parser.spec.ts b/__tests__/matcher/path-parser.spec.ts index dbcf90e6..aa27eed8 100644 --- a/__tests__/matcher/path-parser.spec.ts +++ b/__tests__/matcher/path-parser.spec.ts @@ -581,7 +581,7 @@ describe('Path parser', () => { // TODO: better syntax? like /a/{b-:param}+ // also to allow repeatable because otherwise groups are meaningless - it('group+', () => { + it('groups (extract a part of the param)', () => { matchParams('/a/:a(?:b-([^/]+\\)?)', '/a/b-one', { a: 'one', }) diff --git a/__tests__/ssr/shared.ts b/__tests__/ssr/shared.ts index 9392cc56..7e5cd775 100644 --- a/__tests__/ssr/shared.ts +++ b/__tests__/ssr/shared.ts @@ -61,8 +61,7 @@ export function renderApp( const { app, router } = createApp(routerOptions, vueOptions) // wait until router has resolved possible async components and hooks - // TODO: rename the promise one to isReady - router.onReady().then(() => { + router.isReady().then(() => { // const matchedComponents = router.getMatchedComponents() const matchedComponents = router.currentRoute.matched // no matched routes, reject with 404 diff --git a/src/router.ts b/src/router.ts index 8b7d9f03..4dabd2b7 100644 --- a/src/router.ts +++ b/src/router.ts @@ -68,8 +68,7 @@ export interface Router { // TODO: also return a ListenerRemover onError(handler: ErrorHandler): void - // TODO: change to isReady - onReady(): Promise + isReady(): Promise } export function createRouter({ @@ -456,7 +455,7 @@ export function createRouter({ markAsReady() } - function onReady(): Promise { + function isReady(): Promise { if (ready && currentRoute !== START_LOCATION_NORMALIZED) return Promise.resolve() return new Promise((resolve, reject) => { @@ -563,7 +562,7 @@ export function createRouter({ afterEach, createHref, onError, - onReady, + isReady, doInitialNavigation, setActiveApp,