Skip to content

Commit

Permalink
setRoute broken because of missing this
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben authored and indexzero committed Nov 30, 2011
1 parent 7f14d24 commit 8dd89a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/director/browser.js
Expand Up @@ -112,7 +112,7 @@ var listener = {

setHash: function (s) {
// Mozilla always adds an entry to the history
if (mode === 'legacy') {
if (this.mode === 'legacy') {
this.writeFrame(s);
}

Expand Down
16 changes: 16 additions & 0 deletions test/browser/routes-test.js
Expand Up @@ -614,3 +614,19 @@ createTest('functions should have |this| context of the router instance.', {
this.finish();
});
});

createTest('setRoute with a single parameter should change location correctly', {
'/bonk': {
on: function() {
shared.fired.push(window.location.hash);
}
}
}, function() {
var self = this;
shared.fired = [];
this.router.setRoute('/bonk');
setTimeout(function() {
deepEqual(shared.fired, ['#/bonk']);
self.finish();
}, 14)
});

0 comments on commit 8dd89a1

Please sign in to comment.