Skip to content

Commit

Permalink
Flush tail if carbon-routed failed to match
Browse files Browse the repository at this point in the history
  • Loading branch information
TimvdLippe committed May 4, 2016
1 parent 337d8d4 commit 104d2de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions carbon-route.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@
__resetProperties: function() {
this._setActive(false);
this._matched = null;
//this.tail = { path: null, prefix: null, queryParams: null };
//this.data = {};
this.tail = { path: null, prefix: null, __queryParams: null };
this.data = {};
},

__tryToMatch: function(path, pattern) {
Expand Down
7 changes: 3 additions & 4 deletions test/carbon-route.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,12 @@

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'});
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 Expand Up @@ -184,7 +183,7 @@
routes.foo.set('route.path', '/foo/321/baz/zyx');

expect(routes.foo.data).to.be.eql({ foo: '321' });
expect(routes.bar.data).to.be.eql({ bar: 'abc' });
expect(routes.bar.data).to.be.eql({});
expect(routes.baz.data).to.be.eql({ baz: 'zyx' });
});

Expand Down

0 comments on commit 104d2de

Please sign in to comment.