Skip to content

Commit

Permalink
Merge pull request jashkenas#2455 from williamhc/patch-1
Browse files Browse the repository at this point in the history
return from Backbone.history.navigate whether a route was matched.
  • Loading branch information
jashkenas committed Apr 4, 2013
2 parents 9116dde + 746aa1d commit 852aaf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@
} else {
return this.location.assign(url);
}
if (options.trigger) this.loadUrl(fragment);
if (options.trigger) return this.loadUrl(fragment);
},

// Update the hash location, either replacing the current entry, or adding
Expand Down
4 changes: 4 additions & 0 deletions test/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ $(document).ready(function() {
equal(router.page, '20');
});

test("reports matched route via nagivate", 1, function() {
ok(Backbone.history.navigate('search/manhattan/p20', true));
});

test("route precedence via navigate", 6, function(){
// check both 0.9.x and backwards-compatibility options
_.each([ { trigger: true }, true ], function( options ){
Expand Down

0 comments on commit 852aaf6

Please sign in to comment.