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

Commit 4b8e49e

Browse files
committed
Data should be reset when the pattern no longer matches.
1 parent 951dc29 commit 4b8e49e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

app-route.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
__resetProperties: function() {
238238
this._setActive(false);
239239
this._matched = null;
240+
this.data = {};
240241
},
241242

242243
__tryToMatch: function() {

test/app-route.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@
169169

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

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

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

178-
expect(route.data).to.be.deep.equal({username: 'sans'});
178+
expect(route.data).to.be.deep.equal({});
179179
expect(route.active).to.be.equal(false);
180180

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

0 commit comments

Comments
 (0)