Skip to content

Commit

Permalink
Avoid rearrange query parameters (#946)
Browse files Browse the repository at this point in the history
* avoid rearrange query params

* delete unit text about query sorted alphabetically

* delete unit text about query sorted alphabetically
  • Loading branch information
miccycn authored and yyx990803 committed Nov 28, 2016
1 parent c174f8d commit d4de8c8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/util/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function parseQuery (query: string): Dictionary<string> {
}

export function stringifyQuery (obj: Dictionary<string>): string {
const res = obj ? Object.keys(obj).sort().map(key => {
const res = obj ? Object.keys(obj).map(key => {
const val = obj[key]

if (val === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/active-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
.assert.attributeContains('li:nth-child(6) a', 'href', '/active-links/users/evan#foo')
.assert.attributeContains('li:nth-child(7) a', 'href', '/active-links/users/evan?foo=bar')
.assert.attributeContains('li:nth-child(8) a', 'href', '/active-links/users/evan?foo=bar')
.assert.attributeContains('li:nth-child(9) a', 'href', '/active-links/users/evan?baz=qux&foo=bar')
.assert.attributeContains('li:nth-child(9) a', 'href', '/active-links/users/evan?foo=bar&baz=qux')
.assert.attributeContains('li:nth-child(10) a', 'href', '/active-links/about')
.assert.attributeContains('li:nth-child(11) a', 'href', '/active-links/about')
.assert.containsText('.view', 'Home')
Expand Down
10 changes: 0 additions & 10 deletions test/unit/specs/query.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,4 @@ describe('Query utils', () => {
}))
})
})

describe('stringifyQuery', () => {
it('should work', () => {
expect(stringifyQuery({
foo: 'bar',
baz: 'qux',
arr: [1, 2]
})).toBe('?arr=1&arr=2&baz=qux&foo=bar') // sorted alphabetically
})
})
})

0 comments on commit d4de8c8

Please sign in to comment.