OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>Tests for known named character references</title> |
| 4 <meta name=viewport content="width=device-width"> |
| 5 <!-- Alternative output: http://mathias.html5.org/tests/html/named-character-re
ferences/ --> |
| 6 <div id=log></div> |
| 7 <script src=../../../../../resources/testharness.js></script> |
| 8 <script src=../../../../../resources/testharnessreport.js></script> |
| 9 <script src=named-character-references-data.js></script> |
| 10 <script> |
| 11 (function() { |
| 12 |
| 13 function pad(string, totalCharacters) { |
| 14 return totalCharacters < string.length ? string : (Array(totalCharacters +
1).join('0') + string).slice(-totalCharacters); |
| 15 } |
| 16 |
| 17 var dummy = document.createElement('p'); |
| 18 |
| 19 Object.keys(data).forEach(function(entity) { |
| 20 var object = data[entity]; |
| 21 dummy.innerHTML = entity; |
| 22 test( |
| 23 function() { |
| 24 assert_equals( |
| 25 dummy.textContent, |
| 26 object.characters |
| 27 ); |
| 28 }, |
| 29 entity + ' should match ' + object.codepoints.map(function(codePoint) { |
| 30 return 'U+' + pad(codePoint.toString(16).toUpperCase(), 5); |
| 31 }).join(' ') |
| 32 ); |
| 33 }); |
| 34 |
| 35 }()); |
| 36 </script> |
OLD | NEW |