servo/tests/wpt/web-platform-tests/encoding/textdecoder-labels.html
Ms2ger 296fa2512b Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180.
- Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
2017-02-06 22:38:29 +01:00

35 lines
1.4 KiB
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) {
test(function(t) {
assert_equals(
new TextDecoder(label).encoding, encoding.name,
'label for encoding should match');
assert_equals(
new TextDecoder(label.toUpperCase()).encoding, encoding.name,
'label matching should be case-insensitive');
whitespace.forEach(function(ws) {
assert_equals(
new TextDecoder(ws + label).encoding, encoding.name,
'label for encoding with leading whitespace should match');
assert_equals(
new TextDecoder(label + ws).encoding, encoding.name,
'label for encoding with trailing whitespace should match');
assert_equals(
new TextDecoder(ws + label + ws).encoding, encoding.name,
'label for encoding with surrounding whitespace should match');
});
}, label + ' => ' + encoding.name);
});
});
});
</script>