OLD | NEW |
---|---|
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('../resources/fetch-test-helpers.js'); | 2 importScripts('../resources/fetch-test-helpers.js'); |
3 } | 3 } |
4 | 4 |
5 test(function() { | 5 test(function() { |
6 var expectedValueMap = { | 6 var expectedValueMap = { |
7 'content-language': 'ja', | 7 'content-language': 'ja', |
8 'content-type': 'text/html; charset=UTF-8', | 8 'content-type': 'text/html; charset=UTF-8', |
9 'x-fetch-test': 'response test field' | 9 'x-fetch-test': 'response test field' |
10 }; | 10 }; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 | 244 |
245 headers.delete('a'); | 245 headers.delete('a'); |
246 headers.set('d', '4'); | 246 headers.set('d', '4'); |
247 | 247 |
248 const keys = []; | 248 const keys = []; |
249 for (let [key, value] of iterator) | 249 for (let [key, value] of iterator) |
250 keys.push(key); | 250 keys.push(key); |
251 assert_array_equals(keys, ['a', 'b', 'c'], | 251 assert_array_equals(keys, ['a', 'b', 'c'], |
252 'The pairs to iterate over should be the return ' + | 252 'The pairs to iterate over should be the return ' + |
253 'value of an algorithm that implicitly makes a copy.'); | 253 'value of an algorithm that implicitly makes a copy.'); |
254 }, 'Iteration mutation'); | 254 }, 'Iteration mutation'); |
jsbell
2016/12/12 16:54:50
Can you add value mutations to this test?
| |
255 | 255 |
256 test(function(t) { | |
257 const headers = new Headers(); | |
258 headers.append('b', '1'); | |
259 headers.append('b', '2'); | |
260 headers.append('a', '4'); | |
261 headers.append('a', '2'); | |
262 headers.append('a', '3'); | |
263 const keys = [], values = []; | |
264 for (let [k, v] of headers){ | |
265 keys.push(k); | |
266 values.push(v); | |
267 } | |
268 assert_array_equals(keys, ['a', 'b'], | |
269 'The pairs to iterate over should be the return ' + | |
270 'value of an algorithm that implicitly makes a copy.'); | |
271 assert_array_equals(values, ['2,3,4', '1,2'], | |
272 'The values should be sorted.'); | |
jsbell
2016/12/12 16:54:50
The spec does not indicate that values should be s
| |
273 },'Sorted and combined on iteration'); | |
jsbell
2016/12/12 16:54:50
nit: space after comma
| |
274 | |
256 done(); | 275 done(); |
OLD | NEW |