OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <title>Encoding API: Encoding names</title> |
| 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <script src="resources/shared.js"></script> |
3 <script> | 6 <script> |
4 | 7 |
5 description("Test the Encoding API's use of encoding names"); | 8 test(function() { |
6 | 9 |
7 debug("Encoding names are case insensitive"); | 10 var encodings = [ |
8 var encodings = [ | 11 { label: 'utf-8', encoding: 'utf-8' }, |
9 { label: 'utf-8', encoding: 'utf-8' }, | 12 { label: 'utf-16', encoding: 'utf-16le' }, |
10 { label: 'utf-16', encoding: 'utf-16le' }, | 13 { label: 'utf-16le', encoding: 'utf-16le' }, |
11 { label: 'utf-16le', encoding: 'utf-16le' }, | 14 { label: 'utf-16be', encoding: 'utf-16be' }, |
12 { label: 'utf-16be', encoding: 'utf-16be' }, | 15 { label: 'ascii', encoding: 'windows-1252' }, |
13 { label: 'ascii', encoding: 'windows-1252' }, | 16 { label: 'iso-8859-1', encoding: 'windows-1252' } |
14 { label: 'iso-8859-1', encoding: 'windows-1252' } | 17 ]; |
15 ]; | |
16 | 18 |
17 // encoding-labels.html tests the full set of names/labels; this test just | 19 // encoding-labels.html tests the full set of names/labels; this test just |
18 // exercises some common cases and case-insensitivity. | 20 // exercises some common cases and case-insensitivity. |
19 | 21 |
20 encodings.forEach(function(test) { | 22 encodings.forEach(function(t) { |
21 shouldBeEqualToString("new TextDecoder('" + test.label.toLowerCase() + "').e
ncoding", test.encoding); | 23 assert_equals(new TextDecoder(t.label.toLowerCase()).encoding, t.encodin
g); |
22 shouldBeEqualToString("new TextDecoder('" + test.label.toUpperCase() + "').e
ncoding", test.encoding); | 24 assert_equals(new TextDecoder(t.label.toUpperCase()).encoding, t.encodin
g); |
23 }); | 25 }); |
| 26 |
| 27 }, 'Encoding labels are case-insensitive'); |
24 | 28 |
25 </script> | 29 </script> |
OLD | NEW |