Permalink
Browse files

fix(UrlParser): stop setting default value 'true' (#10399)

  • Loading branch information...
1 parent c8989c9 commit 0d6cc17252eb128d1501dce4dc1f98e5dc853e69 @laco0416 laco0416 committed with robwormald Jul 30, 2016
Showing with 13 additions and 3 deletions.
  1. +1 −1 modules/@angular/router/src/url_tree.ts
  2. +12 −2 modules/@angular/router/test/url_serializer.spec.ts
@@ -406,7 +406,7 @@ class UrlParser {
return;
}
this.capture(key);
- let value: any = 'true';
+ let value: any = '';
if (this.peekStartsWith('=')) {
this.capture('=');
var valueMatch = matchUrlQueryParamValue(this.remaining);
@@ -142,12 +142,22 @@ describe('url serializer', () => {
it('should parse key only query params', () => {
const tree = url.parse('/one?a');
- expect(tree.queryParams).toEqual({a: 'true'});
+ expect(tree.queryParams).toEqual({a: ''});
+ });
+
+ it('should parse a value-empty query param', () => {
+ const tree = url.parse('/one?a=');
+ expect(tree.queryParams).toEqual({a: ''});
+ });
+
+ it('should parse value-empty query params', () => {
+ const tree = url.parse('/one?a=&b=');
+ expect(tree.queryParams).toEqual({a: '', b: ''});
});
it('should serializer query params', () => {
const tree = url.parse('/one?a');
- expect(url.serialize(tree)).toEqual('/one?a=true');
+ expect(url.serialize(tree)).toEqual('/one?a=');
});
it('should parse fragment', () => {

0 comments on commit 0d6cc17

Please sign in to comment.