OLD | NEW |
1 description("Tests when line breaking is allowed after a question mark character
."); | 1 description("Tests when line breaking is allowed after a question mark character
."); |
2 | 2 |
3 var div = document.body.appendChild(document.createElement("div")); | 3 var div = document.body.appendChild(document.createElement("div")); |
4 div.style.width = "1px"; | 4 div.style.width = "1px"; |
5 div.style.fontFamily = "ahem"; | 5 div.style.fontFamily = "Ahem"; |
6 div.style.fontSize = "25px"; | 6 div.style.fontSize = "25px"; |
7 | 7 |
8 function allowsBreakBefore(i) | 8 function allowsBreakBefore(i) |
9 { | 9 { |
10 div.innerText = "A?" + String.fromCharCode(i); | 10 div.innerText = "A?" + String.fromCharCode(i); |
11 return div.offsetHeight > 25; | 11 return div.offsetHeight > 25; |
12 } | 12 } |
13 | 13 |
14 var unallowedBreaks = [0x21, 0x22, 0x27, 0x29, 0x2c, 0x2e, 0x2f, 0x3a, 0x3b, 0x3
f, 0x5d, 0x7d]; | 14 var unallowedBreaks = [0x21, 0x22, 0x27, 0x29, 0x2c, 0x2e, 0x2f, 0x3a, 0x3b, 0x3
f, 0x5d, 0x7d]; |
15 | 15 |
16 for (var i = 33; i < 128; ++i) | 16 for (var i = 33; i < 128; ++i) |
17 shouldBe("allowsBreakBefore(" + i + ")", unallowedBreaks.indexOf(i) >= 0 ? "
false" : "true"); | 17 shouldBe("allowsBreakBefore(" + i + ")", unallowedBreaks.indexOf(i) >= 0 ? "
false" : "true"); |
18 | 18 |
19 document.body.removeChild(div); | 19 document.body.removeChild(div); |
OLD | NEW |