blob: 6aa74c4c6d3b3eec0da708f5d75670842e1e1246 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body id="body">
<div tabindex="0" role="group" id="images">
<img alt="cake0" src="resources/cake.png" /><br />
<img alt class="cake1 unassigned-alt" src="resources/cake.png" /><br />
<img alt="" class="cake1 empty-alt" src="resources/cake.png" /><br />
<img alt="cake2" src="resources/cake.png" /><br />
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description(
'This tests that img elements with an alt attribute and no assigned value, or an empty alt value, are ignored.',
);
if (window.accessibilityController) {
document.getElementById('images').focus();
var imagesGroup = accessibilityController.focusedElement;
// there are 4 images, but one has an alt attribute that is unassigned and another has an empty alt, so it should be
// ignored. as a result, the image count is 2.
shouldBe('imagesGroup.childrenCount', '2');
// make sure alt text is being read before and after
shouldBeEqualToString(
'platformValueForW3CName(imagesGroup.childAtIndex(0))',
'cake0',
);
shouldBeEqualToString(
'platformValueForW3CName(imagesGroup.childAtIndex(1))',
'cake2',
);
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>