Skip to content

Commit

Permalink
Add router test for urls with encoded characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Vogel committed Mar 29, 2012
1 parent fd4df5a commit 59b39c4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ $(document).ready(function() {

initialize : function(options) {
this.testing = options.testing;
this.route(/(reg exp)/, 'regexp');
this.route('implicit', 'implicit');
},

Expand Down Expand Up @@ -93,6 +94,10 @@ $(document).ready(function() {

anything : function(whatever) {
this.anything = whatever;
},

regexp : function(regexp) {
this.regexp = regexp;
}

// do not provide a callback method for the noCallback route
Expand Down Expand Up @@ -263,6 +268,14 @@ $(document).ready(function() {
equal(router.rest, 'has%20space');
});

asyncTest("Router: route url with encoded character", function() {
window.location.hash = 'reg exp';
setTimeout(function() {
equal(router.regexp, 'reg exp');
start();
}, 10);
});

asyncTest("Router: correctly handles URLs with % (#868)", 3, function() {
window.location.hash = 'search/fat%3A1.5%25';
setTimeout(function() {
Expand Down

0 comments on commit 59b39c4

Please sign in to comment.