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

Unified Diff: LayoutTests/fast/domurl/url-query-serialize.html

Issue 141003005: Old CL related to URL query (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « LayoutTests/fast/domurl/url-query-parse.html ('k') | LayoutTests/fast/domurl/url-query-set.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/domurl/url-query-serialize.html
diff --git a/LayoutTests/fast/domurl/url-query-serialize.html b/LayoutTests/fast/domurl/url-query-serialize.html
new file mode 100644
index 0000000000000000000000000000000000000000..d022568c285de3b8bd0e68ede1e2db32df5cbf96
--- /dev/null
+++ b/LayoutTests/fast/domurl/url-query-serialize.html
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML>
+<meta charset="utf-8">
+<link rel="help" href="http://url.spec.whatwg.org/#interface-urlquery">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+test(function() {
+ var q = new URLQuery();
+ q.append('a', 'b c');
+ assert_equals(q + '', 'a=b+c');
+
+ q.delete('a');
+ q.append('a b', 'c');
+ assert_equals(q + '', 'a+b=c');
+}, 'Serialize space');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('a', '');
+ assert_equals(q + '', 'a=');
+
+ q.append('a', '');
+ assert_equals(q + '', 'a=&a=');
+
+ q.append('', 'b');
+ assert_equals(q + '', 'a=&a=&=b');
+
+ q.append('', '');
+ assert_equals(q + '', 'a=&a=&=b&=');
+
+ q.append('', '');
+ assert_equals(q + '', 'a=&a=&=b&=&=');
+}, 'Serialize empty value');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('', 'b');
+ assert_equals(q + '', '=b');
+
+ q.append('', 'b');
+ assert_equals(q + '', '=b&=b');
+}, 'Serialize empty name');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('', '');
+ assert_equals(q + '', '=');
+
+ q.append('', '');
+ assert_equals(q + '', '=&=');
+}, 'Serialize empty name and value');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('a', 'b+c');
+ assert_equals(q + '', 'a=b%2Bc');
+
+ q.delete('a');
+ q.append('a+b', 'c');
+ assert_equals(q + '', 'a%2Bb=c');
+}, 'Serialize +');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('=', 'a');
+ assert_equals(q + '', '%3D=a');
+
+ q.append('b', '=');
+ assert_equals(q + '', '%3D=a&b=%3D');
+}, 'Serialize =');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('&', 'a');
+ assert_equals(q + '', '%26=a');
+
+ q.append('b', '&');
+ assert_equals(q + '', '%26=a&b=%26');
+}, 'Serialize &');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('a', '*-._');
+ assert_equals(q + '', 'a=*-._');
+
+ q.delete('a');
+ q.append('*-._', 'c');
+ assert_equals(q + '', '*-._=c');
+}, 'Serialize *-._');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('a', 'b%c');
+ assert_equals(q + '', 'a=b%25c');
+
+ q.delete('a');
+ q.append('a%b', 'c');
+ assert_equals(q + '', 'a%25b=c');
+}, 'Serialize %');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('a', 'b\0c');
+ assert_equals(q + '', 'a=b%00c');
+
+ q.delete('a');
+ q.append('a\0b', 'c');
+ assert_equals(q + '', 'a%00b=c');
+}, 'Serialize \\0');
+
+test(function() {
+ var q = new URLQuery();
+ q.append('a', 'b\uD83D\uDCA9c');
+ assert_equals(q + '', 'a=b%F0%9F%92%A9c');
+
+ q.delete('a');
+ q.append('a\uD83D\uDCA9b', 'c');
+ assert_equals(q + '', 'a%F0%9F%92%A9b=c');
+}, 'Serialize \uD83D\uDCA9'); // Unicode Character 'PILE OF POO' (U+1F4A9)
+
+</script>
« no previous file with comments | « LayoutTests/fast/domurl/url-query-parse.html ('k') | LayoutTests/fast/domurl/url-query-set.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698