diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-15 18:14:23 +0200 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-15 18:16:42 +0200 |
commit | 9ccc0e017934cb94c525acfc1767ff8c4f5d091b (patch) | |
tree | 14f2d4dac028c7c6b2cd5d8c4dda6b56c4a3e2cf | |
parent | 57a842925ce6e12f45805c595cc401b7a2225a81 (diff) |
Fixing url parsing for opening the page with an open mail
-rw-r--r-- | web-ui/app/js/page/router/url_params.js | 6 | ||||
-rw-r--r-- | web-ui/test/spec/page/router/url_params.spec.js | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/web-ui/app/js/page/router/url_params.js b/web-ui/app/js/page/router/url_params.js index 3e999ecc..6521ef43 100644 --- a/web-ui/app/js/page/router/url_params.js +++ b/web-ui/app/js/page/router/url_params.js @@ -27,7 +27,7 @@ define([], function () { function hashTag(hash) { if (hasMailIdent(hash)) { - return /\/(.+)\/mail\/\d+$/.exec(getDocumentHash())[1]; + return /\/(.+)\/mail\/[A-Z0-9]+$/.exec(getDocumentHash())[1]; } return hash.substring(2); } @@ -41,11 +41,11 @@ define([], function () { } function hasMailIdent() { - return getDocumentHash().match(/mail\/\d+$/); + return getDocumentHash().match(/mail\/[A-Z0-9]+$/); } function getMailIdent() { - return /mail\/(\d+)$/.exec(getDocumentHash())[1]; + return /mail\/([A-Z0-9]+)$/.exec(getDocumentHash())[1]; } return { diff --git a/web-ui/test/spec/page/router/url_params.spec.js b/web-ui/test/spec/page/router/url_params.spec.js index f1a5a1a5..45f8c382 100644 --- a/web-ui/test/spec/page/router/url_params.spec.js +++ b/web-ui/test/spec/page/router/url_params.spec.js @@ -65,6 +65,12 @@ require(['page/router/url_params'], function (urlParams) { expect(urlParams.getMailIdent()).toEqual('123'); }); + + it('supports uppercase letters and numbers as mail id', function () { + document.location.hash = '/inbox/mail/123ASDADA'; + + expect(urlParams.getMailIdent()).toEqual('123ASDADA'); + }); }); }); |