blob: 742d1d1c66471614c08a07cfe06b551b559ad6de [file] [log] [blame]
<html>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="body">
text
<div id="text-ellipsis" tabindex="0" style="width:50px; text-overflow:ellipsis; overflow:hidden; white-space: nowrap;" class="name">My Writing Nook for iPad. More text, more text, more text.</div>
<div id="text-noellipsis" tabindex="0" style="width:50px; white-space: nowrap;" class="name">My Writing Nook for iPad. More text, more text, more text.</div>
text
<p id="description"></p>
<div id="console"></div>
<script>
if (window.accessibilityController) {
description("This test makes sure that the bounds of text that overflows with ellipsis is correct (shortened to the ellipsis that is).");
// The width of the ellipsis text should be short.
document.getElementById("text-ellipsis").focus();
var textContainer = accessibilityController.focusedElement;
var textNode = textContainer.childrenCount ? textContainer.childAtIndex(0) : textContainer;
var clippedWidth = textNode.width;
// The width of non-ellipsis'd text should be longer.
document.getElementById("text-noellipsis").focus();
textContainer = accessibilityController.focusedElement;
textNode = textContainer.childrenCount ? textContainer.childAtIndex(0) : textContainer;
var fullWidth = textNode.width;
shouldBeTrue("clippedWidth < fullWidth");
}
</script>
</body>
</html>