blob: 1a9d72bf6e7807cad08935acbbc1bf8392785927 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body>
<div id="content">
<div>
<input type="checkbox" id="test1" />
<label for="test1" id="label1">Flash the screen
<ul role="listbox" style="list-style-type: none;">
<li role="option" aria-selected="false">1</li>
<li role="option" aria-selected="true">2</li>
<li role="option">3</li>
</ul>
times.
</label>
</div>
<div>
<input type="checkbox" id="test2" />
<label for="test2" id="label2">Flash the screen
<div role="combobox" id="combobox">
<div role="textbox" id="textbox"></div>
<ul role="listbox" id="listbox" style="list-style-type: none;">
<li role="option" id="option1" aria-selected="false">1</li>
<li role="option" id="option2" aria-selected="true">2</li>
<li role="option" id="option3">3</li>
</ul>
</div>
times.
</label>
</div>
<div>
<input type="checkbox" id="test3" />
<label for="test3" id="label3">Flash the screen
<select size="1">
<option>1</option>
<option selected>2</option>
<option>3</option>
</select>
times.
</label>
</div>
<div>
<input type="checkbox" id="test4" />
<label for="test4" id="label4">Flash the screen
<select size="3">
<option>1</option>
<option selected>2</option>
<option>3</option>
</select>
times.
</label>
</div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests text alternative calculation from label with an embedded listbox.");
if (window.accessibilityController) {
for (var i = 1; i <= 4; i++) {
// Touching the accessibility tree prevents test flakiness in macOS.
// In particular, when this file is viewed with Accessibility Inspector,
// the AXTitle is displayed as expected for all four tests. But when we
// run this test as a layout test without first touching the accessibility
// tree, the AXTitle is often the empty string for most if not all tests.
var axLabel = accessibilityController.accessibleElementById("label" + i);
touchAccessibilityTree(axLabel);
var axElement = accessibilityController.accessibleElementById("test" + i);
debug("Test " + i + ": " + axElement.title);
}
document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>