@@ -56,6 +56,14 @@ describe('url serializer', () => {
5656 expect ( tree . root . children . primary . segments [ 2 ] . path ) . toEqual ( '=' ) ;
5757 } ) ;
5858
59+ it ( 'should parse segments with matrix parameter values containing an =' , ( ) => {
60+ const tree = url . parse ( '/path/to/something;query=file=test;query2=test2' ) ;
61+ expect ( tree . root . children . primary . segments [ 2 ] . path ) . toEqual ( 'something' ) ;
62+ expect ( tree . root . children . primary . segments [ 2 ] . parameterMap . keys ) . toHaveSize ( 2 ) ;
63+ expect ( tree . root . children . primary . segments [ 2 ] . parameterMap . get ( 'query' ) ) . toEqual ( 'file=test' ) ;
64+ expect ( tree . root . children . primary . segments [ 2 ] . parameterMap . get ( 'query2' ) ) . toEqual ( 'test2' ) ;
65+ } ) ;
66+
5967 it ( 'should parse top-level nodes with only secondary segment' , ( ) => {
6068 const tree = url . parse ( '/(left:one)' ) ;
6169
@@ -266,9 +274,9 @@ describe('url serializer', () => {
266274 } ) ;
267275
268276 it ( 'should encode query params leaving sub-delimiters intact' , ( ) => {
269- const percentChars = '/?#&+[] ' ;
270- const percentCharsEncoded = '%2F%3F%23%26%2B%5B%5D%20' ;
271- const intactChars = '!$\'()*,;:= ' ;
277+ const percentChars = '/?#&+= [] ' ;
278+ const percentCharsEncoded = '%2F%3F%23%26%2B%3D% 5B%5D%20' ;
279+ const intactChars = '!$\'()*,;:' ;
272280 const params = percentChars + intactChars ;
273281 const paramsEncoded = percentCharsEncoded + intactChars ;
274282 const mixedCaseString = 'sTrInG' ;
@@ -339,9 +347,9 @@ describe('url serializer', () => {
339347 const unreserved = `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~` ;
340348
341349 it ( 'should encode a minimal set of special characters in queryParams' , ( ) => {
342- const notEncoded = unreserved + `:@!$'*,();= ` ;
343- const encode = ` +%&#[]/?` ;
344- const encoded = `%20%2B%25%26%23%5B%5D%2F%3F` ;
350+ const notEncoded = unreserved + `:@!$'*,();` ;
351+ const encode = ` +%&= #[]/?` ;
352+ const encoded = `%20%2B%25%26%3D% 23%5B%5D%2F%3F` ;
345353
346354 const parsed = url . parse ( '/foo' ) ;
347355
@@ -364,20 +372,21 @@ describe('url serializer', () => {
364372
365373 it ( 'should encode minimal special characters plus parens and semi-colon in matrix params' ,
366374 ( ) => {
367- const notEncoded = unreserved + `:@!$'*,&= ` ;
368- const encode = ` /%#()[];?+` ;
369- const encoded = `%20%2F%25%23%28%29%5B%5D%3B%3F%2B` ;
375+ const notEncoded = unreserved + `:@!$'*,&` ;
376+ const encode = ` /%= #()[];?+` ;
377+ const encoded = `%20%2F%25%3D% 23%28%29%5B%5D%3B%3F%2B` ;
370378
371379 const parsed = url . parse ( '/foo' ) ;
372380
373381 parsed . root . children [ PRIMARY_OUTLET ] . segments [ 0 ] . parameters = { notEncoded, encode} ;
382+
374383 expect ( url . serialize ( parsed ) ) . toBe ( `/foo;notEncoded=${ notEncoded } ;encode=${ encoded } ` ) ;
375384 } ) ;
376385
377386 it ( 'should encode special characters in the path the same as matrix params' , ( ) => {
378- const notEncoded = unreserved + `:@!$'*,&= ` ;
379- const encode = ` /%#()[];?+` ;
380- const encoded = `%20%2F%25%23%28%29%5B%5D%3B%3F%2B` ;
387+ const notEncoded = unreserved + `:@!$'*,&` ;
388+ const encode = ` /%= #()[];?+` ;
389+ const encoded = `%20%2F%25%3D% 23%28%29%5B%5D%3B%3F%2B` ;
381390
382391 const parsed = url . parse ( '/foo' ) ;
383392
@@ -386,14 +395,6 @@ describe('url serializer', () => {
386395 expect ( url . serialize ( parsed ) ) . toBe ( `/${ notEncoded } ${ encoded } ` ) ;
387396 } ) ;
388397
389- it ( 'should preserve = when encoding segments' , ( ) => {
390- const testUrl = '/foo===bar' ;
391-
392- const parsed = url . parse ( testUrl ) ;
393-
394- expect ( url . serialize ( parsed ) ) . toBe ( testUrl ) ;
395- } ) ;
396-
397398 it ( 'should correctly encode ampersand in segments' , ( ) => {
398399 const testUrl = '/parent&child' ;
399400
0 commit comments