mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d
This commit is contained in:
parent
c45192614c
commit
775b784f79
2144 changed files with 58115 additions and 29658 deletions
|
@ -0,0 +1,32 @@
|
|||
// META: title=Encoding API: Encoding labels
|
||||
// META: script=resources/encodings.js
|
||||
|
||||
var whitespace = [' ', '\t', '\n', '\f', '\r'];
|
||||
encodings_table.forEach(function(section) {
|
||||
section.encodings.filter(function(encoding) {
|
||||
return encoding.name !== 'replacement';
|
||||
}).forEach(function(encoding) {
|
||||
encoding.labels.forEach(function(label) {
|
||||
const textDecoderName = encoding.name.toLowerCase(); // ASCII names only, so safe
|
||||
test(function(t) {
|
||||
assert_equals(
|
||||
new TextDecoder(label).encoding, textDecoderName,
|
||||
'label for encoding should match');
|
||||
assert_equals(
|
||||
new TextDecoder(label.toUpperCase()).encoding, textDecoderName,
|
||||
'label matching should be case-insensitive');
|
||||
whitespace.forEach(function(ws) {
|
||||
assert_equals(
|
||||
new TextDecoder(ws + label).encoding, textDecoderName,
|
||||
'label for encoding with leading whitespace should match');
|
||||
assert_equals(
|
||||
new TextDecoder(label + ws).encoding, textDecoderName,
|
||||
'label for encoding with trailing whitespace should match');
|
||||
assert_equals(
|
||||
new TextDecoder(ws + label + ws).encoding, textDecoderName,
|
||||
'label for encoding with surrounding whitespace should match');
|
||||
});
|
||||
}, label + ' => ' + encoding.name);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue