Revision 79196d4e5345634b215ba088b4f25a034cf39a5f authored by Domenic Denicola on 23 June 2017, 21:43:05 UTC, committed by Domenic Denicola on 30 June 2017, 20:23:27 UTC
Follows https://github.com/whatwg/dom/pull/469.
1 parent 13b0e2d
textdecoder-labels.html
<!DOCTYPE html>
<title>Encoding API: Encoding labels</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/encodings.js"></script>
<script>
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);
});
});
});
</script>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...