OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-delete"> |
| 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 params.delete("a"); |
| 9 assert_equals(params + "", "c=d"); |
| 10 params = new URLSearchParams("a=a&b=b&a=a&c=c"); |
| 11 params.delete("a"); |
| 12 assert_equals(params + "", "b=b&c=c"); |
| 13 params = new URLSearchParams("a=a&=&b=b&c=c"); |
| 14 params.delete(""); |
| 15 assert_equals(params + "", "a=a&b=b&c=c"); |
| 16 params = new URLSearchParams("a=a&null=null&b=b"); |
| 17 params.delete(null); |
| 18 assert_equals(params + "", "a=a&b=b"); |
| 19 params = new URLSearchParams("a=a&undefined=undefined&b=b"); |
| 20 params.delete(undefined); |
| 21 assert_equals(params + "", "a=a&b=b"); |
| 22 }, "Delete basics"); |
| 23 |
| 24 test(function() { |
| 25 var params = new URLSearchParams(); |
| 26 params.append("first", 1); |
| 27 assert_true(params.has("first"), "Search params object has name 'first'"); |
| 28 assert_equals(params.get("first"), "1", "Search params object has name 'firs
t' with value '1'"); |
| 29 params.delete("first"); |
| 30 assert_false(params.has("first"), "Search params object has no 'first' name"
); |
| 31 params.append("first", 1); |
| 32 params.append("first", 10); |
| 33 params.delete("first"); |
| 34 assert_false(params.has("first"), "Search params object has no 'first' name"
); |
| 35 }, "Deleting appended multiple"); |
| 36 </script> |
OLD | NEW |