Skip to content

Commit

Permalink
Merge branch 'ciekawy-2.0' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Mar 7, 2016
2 parents 74a48f3 + c4bd263 commit 860b685
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions ionic/util/test/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,33 @@ export function run() {

});

describe('getQuerystring', function() {
it('should have no entries for empty url', () => {
expect(util.getQuerystring('')).toEqual({});
});

it('should have no entries for url with no "?" character', () => {
expect(util.getQuerystring('http://localhost:1234/#key1=1&key2=2')).toEqual({});
});

it('should contain key/value entries for all the parameters after "?" character', () => {
expect(util.getQuerystring('http://localhost:1234/#key0=0&key0x=0x?key1=1&key2=2')).toEqual({
key1: '1',
key2: '2'
});
});

it('should ignore empty ?& and &&', () => {
expect(util.getQuerystring('http://localhost:1234/#?&&')).toEqual({});

expect(util.getQuerystring('http://localhost:1234/#?&&key1=1&key2=2&&')).toEqual({
key1: '1',
key2: '2'
});
});

});

describe('isTrueProperty', function() {

it('should be true from boolean true', () => {
Expand Down
2 changes: 1 addition & 1 deletion ionic/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function getQuerystring(url: string): any {
const startIndex = url.indexOf('?');
if (startIndex !== -1) {
const queries = url.slice(startIndex + 1).split('&');
queries.forEach((param) => {
queries.filter((param) => { return param.indexOf('=') > 0; }).forEach((param) => {
var split = param.split('=');
queryParams[split[0].toLowerCase()] = split[1].split('#')[0];
});
Expand Down

0 comments on commit 860b685

Please sign in to comment.