Update web-platform-tests to revision be5419e845d39089ba6dc338c1bd0fa279108317

This commit is contained in:
Josh Matthews 2018-01-04 13:44:24 -05:00
parent aa199307c8
commit 2b6f573eb5
3440 changed files with 109438 additions and 41750 deletions

View file

@ -74,6 +74,20 @@ test_blob(function() {
type: "",
desc: "A plain object with @@iterator should be treated as a sequence for the blobParts argument."
});
test(t => {
const blob = new Blob({
[Symbol.iterator]() {
var i = 0;
return {next: () => [
{done:false, value:'ab'},
{done:false, value:'cde'},
{done:true}
][i++]
};
}
});
assert_equals(blob.size, 5, 'Custom @@iterator should be treated as a sequence');
}, "A plain object with custom @@iterator should be treated as a sequence for the blobParts argument.");
test_blob(function() {
return new Blob({
[Symbol.iterator]: Array.prototype[Symbol.iterator],
@ -392,26 +406,20 @@ test_blob(function() {
desc: "Array with mixed types"
});
// options argument
test(function() {
new Blob([], { endings: "invalidEnumValue" });
new Blob([], { endings: null });
new Blob([], { endings: undefined });
new Blob([], { endings: 0 });
new Blob([], { get endings() { assert_unreached("Should not call getter"); } });
}, "The 'endings' property should be ignored.");
const accessed = [];
const stringified = [];
test(function() {
assert_throws(test_error, function() {
new Blob([], {
get type() { throw test_error; }
});
new Blob([], {
get type() { accessed.push('type'); },
get endings() { accessed.push('endings'); }
});
assert_throws(test_error, function() {
new Blob([], {
type: { toString: function() { throw test_error; } }
});
new Blob([], {
type: { toString: () => { stringified.push('type'); return ''; } },
endings: { toString: () => { stringified.push('endings'); return 'transparent'; } }
});
assert_array_equals(accessed, ['endings', 'type']);
assert_array_equals(stringified, ['endings', 'type']);
}, "options properties should be accessed in lexicographic order.");
test(function() {
@ -449,19 +457,16 @@ test(function() {
});
});
test_blob(function() {
return new Blob(["\na\r\nb\n\rc\r"], { endings: "transparent" });
}, {
expected: "\na\r\nb\n\rc\r",
type: "",
desc: "Newlines should not change when endings is 'transparent'."
});
test_blob(function() {
return new Blob(["\na\r\nb\n\rc\r"], { endings: "native" });
}, {
expected: "\na\r\nb\n\rc\r",
type: "",
desc: "Newlines should not change when endings is 'native'."
[
123,
123.4,
true,
'abc'
].forEach(arg => {
test(t => {
assert_throws(new TypeError(), () => new Blob([], arg),
'Blob constructor should throw with invalid property bag');
}, `Passing ${JSON.stringify(arg)} for options should throw`);
});
var type_tests = [
@ -471,6 +476,7 @@ var type_tests = [
[[], 'A', 'a'],
[[], 'text/html', 'text/html'],
[[], 'TEXT/HTML', 'text/html'],
[[], 'text/plain;charset=utf-8', 'text/plain;charset=utf-8'],
[[], '\u00E5', ''],
[[], '\uD801\uDC7E', ''], // U+1047E
[[], ' image/gif ', ' image/gif '],