Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
Data should be reset when the pattern no longer matches.
Browse files Browse the repository at this point in the history
  • Loading branch information
jishi9 committed Dec 12, 2017
1 parent 951dc29 commit 4b8e49e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions app-route.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
__resetProperties: function() {
this._setActive(false);
this._matched = null;
this.data = {};
},

__tryToMatch: function() {
Expand Down
6 changes: 3 additions & 3 deletions test/app-route.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@

route.pattern = '/user/:username/likes/:count';

// At the moment, we don't reset data when we no longer match.
expect(route.data).to.be.deep.equal({username: 'sans'});
// The data should reset when we no longer match.
expect(route.data).to.be.deep.equal({});
expect(route.active).to.be.equal(false);

route.set('route.path', "/does/not/match");

expect(route.data).to.be.deep.equal({username: 'sans'});
expect(route.data).to.be.deep.equal({});
expect(route.active).to.be.equal(false);

route.set('route.path', '/user/undyne/likes/20');
Expand Down

0 comments on commit 4b8e49e

Please sign in to comment.