<!DOCTYPE html>
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<meta http-equiv="content-language" content="en, es">
</head>
<body id="body" role="main">
<p id="paragraph" lang="pl">Polish.
<span id="span">Possibly in another language.</span>
</p>
<script>
setup(() => {
window.axRoot = accessibilityController.rootElement;
window.axBody = accessibilityController.accessibleElementById('body');
window.axParagraph = accessibilityController.accessibleElementById('paragraph');
window.axSpan = accessibilityController.accessibleElementById('span');
});
test(() => {
assert_equals(window.axRoot.language, 'AXLanguage: en',
'The first language in the meta tag should apply.');
assert_equals(window.axBody.language, 'AXLanguage: ',
'Body should not inherit language Blink side.');
assert_equals(window.axParagraph.language, 'AXLanguage: pl',
'The language in the lang attribute should apply.');
assert_equals(window.axSpan.language, 'AXLanguage: ',
'Span should not inherit language Blink side.');
}, 'Tests if the content-language meta tag and the lang attribute are picked up by the accessibility component.');
test(() => {
assert_equals(window.axRoot.language, 'AXLanguage: en',
'The first language in the meta tag should apply.');
document.documentElement.lang = 'ru';
assert_equals(window.axRoot.language, 'AXLanguage: ru',
'The lang attribute on the html element has changed.');
assert_equals(window.axBody.language, 'AXLanguage: ',
'Body should not inherit lanugage Blink side.');
assert_equals(window.axParagraph.language, 'AXLanguage: pl',
'The lang attribute on the html element should not affect the lang attribute on the paragraph.');
assert_equals(window.axSpan.language, 'AXLanguage: ',
'Span should not inherit language Blink side.');
document.documentElement.lang = '';
document.getElementById('paragraph').lang = 'it';
assert_equals(window.axParagraph.language, 'AXLanguage: it',
'The lang attribute on the paragraph has changed.');
assert_equals(window.axSpan.language, 'AXLanguage: ',
'Span should not inherit language Blink side.');
document.getElementById('paragraph').lang = 'pl';
document.getElementById('span').lang = 'es';
assert_equals(window.axSpan.language, 'AXLanguage: es',
'The lang attribute on the span has changed.');
document.getElementById('span').lang = '';
}, 'Tests if dynamically changing lang attributes is picked up by the accessibility component.');
</script>
</body>
</html>