Index: third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-set.html |
diff --git a/third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-set.html b/third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-set.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3caae1fc33f360601f516c05f81d15b516645425 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-set.html |
@@ -0,0 +1,35 @@ |
+<!doctype html> |
+<html> |
+<head> |
+<meta charset="utf8"> |
+<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-set"> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="resources/testharness-extras.js"></script> |
+<script> |
+test(function() { |
+ var params = new URLSearchParams('a=b&c=d'); |
+ params.set('a', 'B'); |
+ assert_equals(params + '', 'a=B&c=d'); |
+ params = new URLSearchParams('a=b&c=d&a=e'); |
+ params.set('a', 'B'); |
+ assert_equals(params + '', 'a=B&c=d') |
+ params.set('e', 'f'); |
+ assert_equals(params + '', 'a=B&c=d&e=f') |
+}, 'Set basics'); |
+ |
+test(function() { |
+ var params = new URLSearchParams('a=1&a=2&a=3'); |
+ assert_true(params.has('a'), 'Search params object has name "a"'); |
+ assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"'); |
+ params.set('first', 4); |
+ assert_true(params.has('a'), 'Search params object has name "a"'); |
+ assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"'); |
+ params.set('a', 4); |
+ assert_true(params.has('a'), 'Search params object has name "a"'); |
+ assert_equals(params.get('a'), '4', 'Search params object has name "a" with value "4"'); |
+}, 'URLSearchParams.set'); |
+</script> |
+</head> |
+</html> |
+ |