Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: LayoutTests/fast/domurl/url-searchparams-delete.html

Issue 143313002: Implement URLSearchParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More tests + ref count unattached URLSearchParams objects Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/domurl/url-searchparams-delete.html
diff --git a/LayoutTests/fast/domurl/url-searchparams-delete.html b/LayoutTests/fast/domurl/url-searchparams-delete.html
new file mode 100644
index 0000000000000000000000000000000000000000..6fa574db91e15a6cbe349289023667166314be14
--- /dev/null
+++ b/LayoutTests/fast/domurl/url-searchparams-delete.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-delete">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ var params = new URLSearchParams("a=b&c=d");
+ params.delete("a");
+ assert_equals(params + "", "c=d");
+ params = new URLSearchParams("a=a&b=b&a=a&c=c");
+ params.delete("a");
+ assert_equals(params + "", "b=b&c=c");
+ params = new URLSearchParams("a=a&=&b=b&c=c");
+ params.delete("");
+ assert_equals(params + "", "a=a&b=b&c=c");
+ params = new URLSearchParams("a=a&null=null&b=b");
+ params.delete(null);
+ assert_equals(params + "", "a=a&b=b");
+ params = new URLSearchParams("a=a&undefined=undefined&b=b");
+ params.delete(undefined);
+ assert_equals(params + "", "a=a&b=b");
+}, "Delete basics");
+
+test(function() {
+ var params = new URLSearchParams();
+ params.append("first", 1);
+ assert_true(params.has("first"), "Search params object has name 'first'");
+ assert_equals(params.get("first"), "1", "Search params object has name 'first' with value '1'");
+ params.delete("first");
+ assert_false(params.has("first"), "Search params object has no 'first' name");
+ params.append("first", 1);
+ params.append("first", 10);
+ params.delete("first");
+ assert_false(params.has("first"), "Search params object has no 'first' name");
+}, "Deleting appended multiple");
+</script>

Powered by Google App Engine
This is Rietveld 408576698