OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <link rel="help" href="http://url.spec.whatwg.org/#interface-urlsearchparams-has
"> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 test(function() { |
| 7 var params = new URLSearchParams("a=b&c=d"); |
| 8 assert_true(params.has("a")); |
| 9 assert_true(params.has("c")); |
| 10 assert_false(params.has("e")); |
| 11 params = new URLSearchParams("a=b&c=d&a=e"); |
| 12 assert_true(params.has("a")); |
| 13 params = new URLSearchParams("=b&c=d"); |
| 14 assert_true(params.has("")); |
| 15 params = new URLSearchParams("null=a"); |
| 16 assert_true(params.has(null)); |
| 17 }, "Has basics"); |
| 18 |
| 19 test(function() { |
| 20 var params = new URLSearchParams("a=b&c=d&&"); |
| 21 params.append("first", 1); |
| 22 params.append("first", 2); |
| 23 assert_true(params.has("a"), "Search params object has name 'a'"); |
| 24 assert_true(params.has("c"), "Search params object has name 'c'"); |
| 25 assert_true(params.has("first"), "Search params object has name 'first'"); |
| 26 assert_false(params.has("d"), "Search params object has no name 'd'"); |
| 27 params.delete("first"); |
| 28 assert_false(params.has("first"), "Search params object has no name 'first'"
); |
| 29 }, "has() following delete()"); |
| 30 </script> |
OLD | NEW |