11cb0ef41Sopenharmony_citest(function() { 21cb0ef41Sopenharmony_ci var params = new URLSearchParams('a=b&c=d'); 31cb0ef41Sopenharmony_ci assert_true(params.has('a')); 41cb0ef41Sopenharmony_ci assert_true(params.has('c')); 51cb0ef41Sopenharmony_ci assert_false(params.has('e')); 61cb0ef41Sopenharmony_ci params = new URLSearchParams('a=b&c=d&a=e'); 71cb0ef41Sopenharmony_ci assert_true(params.has('a')); 81cb0ef41Sopenharmony_ci params = new URLSearchParams('=b&c=d'); 91cb0ef41Sopenharmony_ci assert_true(params.has('')); 101cb0ef41Sopenharmony_ci params = new URLSearchParams('null=a'); 111cb0ef41Sopenharmony_ci assert_true(params.has(null)); 121cb0ef41Sopenharmony_ci}, 'Has basics'); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_citest(function() { 151cb0ef41Sopenharmony_ci var params = new URLSearchParams('a=b&c=d&&'); 161cb0ef41Sopenharmony_ci params.append('first', 1); 171cb0ef41Sopenharmony_ci params.append('first', 2); 181cb0ef41Sopenharmony_ci assert_true(params.has('a'), 'Search params object has name "a"'); 191cb0ef41Sopenharmony_ci assert_true(params.has('c'), 'Search params object has name "c"'); 201cb0ef41Sopenharmony_ci assert_true(params.has('first'), 'Search params object has name "first"'); 211cb0ef41Sopenharmony_ci assert_false(params.has('d'), 'Search params object has no name "d"'); 221cb0ef41Sopenharmony_ci params.delete('first'); 231cb0ef41Sopenharmony_ci assert_false(params.has('first'), 'Search params object has no name "first"'); 241cb0ef41Sopenharmony_ci}, 'has() following delete()'); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_citest(() => { 271cb0ef41Sopenharmony_ci const params = new URLSearchParams("a=b&a=d&c&e&"); 281cb0ef41Sopenharmony_ci assert_true(params.has('a', 'b')); 291cb0ef41Sopenharmony_ci assert_false(params.has('a', 'c')); 301cb0ef41Sopenharmony_ci assert_true(params.has('a', 'd')); 311cb0ef41Sopenharmony_ci assert_true(params.has('e', '')); 321cb0ef41Sopenharmony_ci params.append('first', null); 331cb0ef41Sopenharmony_ci assert_false(params.has('first', '')); 341cb0ef41Sopenharmony_ci assert_true(params.has('first', 'null')); 351cb0ef41Sopenharmony_ci params.delete('a', 'b'); 361cb0ef41Sopenharmony_ci assert_true(params.has('a', 'd')); 371cb0ef41Sopenharmony_ci}, "Two-argument has()"); 38