From 3ef9c3a5fc587dccbbc29d62c4a9b96036c8953e Mon Sep 17 00:00:00 2001 From: Brad Dunbar Date: Thu, 2 Feb 2012 20:06:48 -0500 Subject: [PATCH] Add tests for #908, #933. --- backbone.js | 2 +- test/router.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/backbone.js b/backbone.js index 5f18acf9..b5f1fea5 100644 --- a/backbone.js +++ b/backbone.js @@ -819,7 +819,7 @@ }; // Cached regex for cleaning leading hashes and slashes . - var routeStripper = /^[#\/]/; + var routeStripper = /^[#/]/; // Cached regex for detecting MSIE. var isExplorer = /msie [\w.]+/; diff --git a/test/router.js b/test/router.js index 79c19313..989eb026 100644 --- a/test/router.js +++ b/test/router.js @@ -200,4 +200,12 @@ $(document).ready(function() { } }); + test("#933, #908 - leading slash", function() { + var history = new Backbone.History(); + history.options = {root: '/root'}; + equal(history.getFragment('/root/foo'), 'foo'); + history.options.root = '/root/'; + equal(history.getFragment('/root/foo'), 'foo'); + }); + });