Changeset View
Changeset View
Standalone View
Standalone View
src/lib/__tests__/URI.js
| Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | it('can remove multiple query data', function() { | ||||
| expect(uri.getQueryParams()).toEqual({ | expect(uri.getQueryParams()).toEqual({ | ||||
| 'clown' : 'town', | 'clown' : 'town', | ||||
| 'key' : null, | 'key' : null, | ||||
| 'herp' : undefined | 'herp' : undefined | ||||
| }); | }); | ||||
| expect(uri.toString()).toEqual('/?clown=town'); | expect(uri.toString()).toEqual('/?clown=town'); | ||||
| }); | }); | ||||
| it('can remove non existant query data', function() { | it('can remove non existent query data', function() { | ||||
| var uri = JX.$U('/?key=value'); | var uri = JX.$U('/?key=value'); | ||||
| uri.addQueryParams({'magic' : null}); | uri.addQueryParams({'magic' : null}); | ||||
| expect(uri.getQueryParams()).toEqual({ | expect(uri.getQueryParams()).toEqual({ | ||||
| 'key' : 'value', | 'key' : 'value', | ||||
| 'magic' : null | 'magic' : null | ||||
| }); | }); | ||||
| expect(uri.toString()).toEqual('/?key=value'); | expect(uri.toString()).toEqual('/?key=value'); | ||||
| }); | }); | ||||
| Show All 21 Lines | it('should not loop indefinitely when parsing empty params', function() { | ||||
| expect(JX.$U('/?&&').getQueryParams()).toEqual({}); | expect(JX.$U('/?&&').getQueryParams()).toEqual({}); | ||||
| }); | }); | ||||
| it('should parse values with =', function() { | it('should parse values with =', function() { | ||||
| expect(JX.$U('/?x=1=1').getQueryParams()).toEqual({'x' : '1=1'}); | expect(JX.$U('/?x=1=1').getQueryParams()).toEqual({'x' : '1=1'}); | ||||
| }); | }); | ||||
| }); | }); | ||||