Skip to content

Commit

Permalink
fix($urlRouter): revert BC: resolve clashing of routes
Browse files Browse the repository at this point in the history
This reverts commit b5c57c8.
Closes #2501
Closes #2496
  • Loading branch information
christopherthielen committed Feb 7, 2016
1 parent c4b30ef commit 2f1ebef
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
6 changes: 0 additions & 6 deletions src/urlRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,6 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
return listener;
}

rules.sort(function(ruleA, ruleB) {
var aLength = ruleA.prefix ? ruleA.prefix.length : 0;
var bLength = ruleB.prefix ? ruleB.prefix.length : 0;
return bLength - aLength;
});

if (!interceptDeferred) listen();

return {
Expand Down
2 changes: 1 addition & 1 deletion test/stateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('state', function () {
}
})
.state('resolveTimeout', {
url: "/:foo",
url: "/resolve-timeout/:foo",
resolve: {
value: function ($timeout) {
return $timeout(function() { log += "Success!"; }, 1);
Expand Down
14 changes: 0 additions & 14 deletions test/urlRouterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ describe("UrlRouter", function () {
return path.replace('baz', 'b4z');
}).when('/foo/:param', function($match) {
match = ['/foo/:param', $match];
}).when('/foo/bar', function($match) {
match = ['/foo/bar', $match];
}).when('/bar', function($match) {
match = ['/bar', $match];
});
Expand All @@ -73,18 +71,6 @@ describe("UrlRouter", function () {
});
});

it("should handle more specified url first", function() {
location.path("/foo/bar");
scope.$emit("$locationChangeSuccess");
expect(match[0]).toBe("/foo/bar");
expect(match[1]).toEqual({});

location.path("/foo/baz");
scope.$emit("$locationChangeSuccess");
expect(match[0]).toBe("/foo/:param");
expect(match[1]).toEqual({param: 'baz'});
});

it("should execute rewrite rules", function () {
location.path("/foo");
scope.$emit("$locationChangeSuccess");
Expand Down

0 comments on commit 2f1ebef

Please sign in to comment.