From 178efc34f80c4483dedc7c8d79b114823eed3072 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Thu, 18 Jun 2015 23:39:42 -0700 Subject: [PATCH] [fixed] when using HashHistory --- modules/HashHistory.js | 4 ++-- modules/RouterContextMixin.js | 8 +++++++- modules/__tests__/Link-test.js | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/HashHistory.js b/modules/HashHistory.js index 0aea659045..85387022d9 100644 --- a/modules/HashHistory.js +++ b/modules/HashHistory.js @@ -164,8 +164,8 @@ class HashHistory extends DOMHistory { this._notifyChange(); } - makeHref(pathname, query) { - return '#' + super.makeHref(pathname, query); + makeHref(path) { + return '#' + path; } } diff --git a/modules/RouterContextMixin.js b/modules/RouterContextMixin.js index 4ba6bc727e..e2e35d7e64 100644 --- a/modules/RouterContextMixin.js +++ b/modules/RouterContextMixin.js @@ -71,7 +71,13 @@ var RouterContextMixin = { * pathname and query. */ makeHref(pathname, query) { - return this.makePath(pathname, query); + var path = this.makePath(pathname, query); + var { history } = this.props; + + if (history && history.makeHref) + return history.makeHref(path); + + return path; }, /** diff --git a/modules/__tests__/Link-test.js b/modules/__tests__/Link-test.js index af68b81914..9928837ec7 100644 --- a/modules/__tests__/Link-test.js +++ b/modules/__tests__/Link-test.js @@ -64,12 +64,12 @@ describe('A ', function () { }); render(( - + ), div, function () { var a = div.querySelector('a'); - expect(a.getAttribute('href')).toEqual('/#/hello/michael?the=query'); + expect(a.getAttribute('href')).toEqual('#/hello/michael?the=query'); }); });