1test(function() { 2 var params = new URLSearchParams('a=b&c=d'); 3 params.set('a', 'B'); 4 assert_equals(params + '', 'a=B&c=d'); 5 params = new URLSearchParams('a=b&c=d&a=e'); 6 params.set('a', 'B'); 7 assert_equals(params + '', 'a=B&c=d') 8 params.set('e', 'f'); 9 assert_equals(params + '', 'a=B&c=d&e=f') 10}, 'Set basics'); 11 12test(function() { 13 var params = new URLSearchParams('a=1&a=2&a=3'); 14 assert_true(params.has('a'), 'Search params object has name "a"'); 15 assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"'); 16 params.set('first', 4); 17 assert_true(params.has('a'), 'Search params object has name "a"'); 18 assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"'); 19 params.set('a', 4); 20 assert_true(params.has('a'), 'Search params object has name "a"'); 21 assert_equals(params.get('a'), '4', 'Search params object has name "a" with value "4"'); 22}, 'URLSearchParams.set'); 23