From 301fbbd4c5f4bc34cf577eb593bfeebbd3fa0fb9 Mon Sep 17 00:00:00 2001 From: Kombu Date: Sun, 28 May 2017 00:03:27 +0800 Subject: [PATCH 1/2] Add TypeScript definition (`linkExactActiveClass`) to RouterOptions --- types/router.d.ts | 1 + types/test/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/router.d.ts b/types/router.d.ts index ac702ab11..ae7d95b00 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -49,6 +49,7 @@ export interface RouterOptions { mode?: RouterMode; base?: string; linkActiveClass?: string; + linkExactActiveClass?: string; parseQuery?: (query: string) => Object; stringifyQuery?: (query: Object) => string; scrollBehavior?: ( diff --git a/types/test/index.ts b/types/test/index.ts index 44864fb32..5354993af 100644 --- a/types/test/index.ts +++ b/types/test/index.ts @@ -41,6 +41,7 @@ const router = new VueRouter({ mode: "history", base: "/", linkActiveClass: "active", + linkExactActiveClass: "exact-active", scrollBehavior: (to, from, savedPosition) => { if (from.path === "/") { return { selector: "#app" }; From 34fa5e128a40222d7e6410a76d3af8002fc55885 Mon Sep 17 00:00:00 2001 From: Kombu Date: Sun, 28 May 2017 00:26:02 +0800 Subject: [PATCH 2/2] Add test for RouterOptions (`linkExactActiveClass`) --- test/e2e/specs/active-links.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/e2e/specs/active-links.js b/test/e2e/specs/active-links.js index 965f22cc5..164978762 100644 --- a/test/e2e/specs/active-links.js +++ b/test/e2e/specs/active-links.js @@ -43,9 +43,11 @@ module.exports = { }) exactActiveA.forEach(i => { browser.assert.cssClassPresent(`li:nth-child(${i}) a`, 'router-link-exact-active') + .assert.cssClassPresent(`li:nth-child(${i}) a`, 'router-link-active') }) exactActiveLI && exactActiveLI.forEach(i => { browser.assert.cssClassPresent(`li:nth-child(${i})`, 'router-link-exact-active') + .assert.cssClassPresent(`li:nth-child(${i})`, 'router-link-active') }) } }