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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/headers.js

Issue 2559273005: [Fetch API] Implement combining of Headers with same keys. (Closed)
Patch Set: ', ' to ',' Created 4 years 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: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/headers.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/headers.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/headers.js
index a87a75febb4649089b93afcb12235d1a2b5a4113..f42bc0dfebab4bc95197a51a8d2da7f05ef246d4 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/headers.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/headers.js
@@ -253,4 +253,23 @@ test(function(t) {
'value of an algorithm that implicitly makes a copy.');
}, 'Iteration mutation');
jsbell 2016/12/12 16:54:50 Can you add value mutations to this test?
+test(function(t) {
+ const headers = new Headers();
+ headers.append('b', '1');
+ headers.append('b', '2');
+ headers.append('a', '4');
+ headers.append('a', '2');
+ headers.append('a', '3');
+ const keys = [], values = [];
+ for (let [k, v] of headers){
+ keys.push(k);
+ values.push(v);
+ }
+ assert_array_equals(keys, ['a', 'b'],
+ 'The pairs to iterate over should be the return ' +
+ 'value of an algorithm that implicitly makes a copy.');
+ assert_array_equals(values, ['2,3,4', '1,2'],
+ 'The values should be sorted.');
jsbell 2016/12/12 16:54:50 The spec does not indicate that values should be s
+},'Sorted and combined on iteration');
jsbell 2016/12/12 16:54:50 nit: space after comma
+
done();

Powered by Google App Engine
This is Rietveld 408576698