From 9c47a78f1aece2b78827d3eca359cb4f3431199c Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 10 Oct 2013 10:18:45 -0300 Subject: [PATCH] Test for #2666. --- test/router.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/router.js b/test/router.js index a123e8ea..296546e4 100644 --- a/test/router.js +++ b/test/router.js @@ -75,6 +75,8 @@ "counter": "counter", "search/:query": "search", "search/:query/p:page": "search", + "charñ": "charUTF", + "char%C3%B1": "charEscaped", "contacts": "contacts", "contacts/new": "newContact", "contacts/:id": "loadContact", @@ -103,11 +105,19 @@ this.count++; }, - search : function(query, page) { + search: function(query, page) { this.query = query; this.page = page; }, + charUTF: function() { + this.charType = 'UTF'; + }, + + charEscaped: function() { + this.charType = 'escaped'; + }, + contacts: function(){ this.contact = 'index'; }, @@ -353,6 +363,13 @@ equal(lastRoute, 'search'); }); + test("#2666 - Hashes with UTF8 in them.", 2, function() { + Backbone.history.navigate('charñ', {trigger: true}); + equal(router.charType, 'UTF'); + Backbone.history.navigate('char%C3%B1', {trigger: true}); + equal(router.charType, 'escaped'); + }); + test("#1185 - Use pathname when hashChange is not wanted.", 1, function() { Backbone.history.stop(); location.replace('http://example.com/path/name#hash');