| <!DOCTYPE html> |
| <html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| |
| <body id="body" role="main"> |
| <p id="paragraph">Some text. |
| <span id="span" lang="pl">Polish.</span> |
| </p> |
| |
| <script> |
| setup(() => { |
| window.languages = internals.userPreferredLanguages(); |
| window.axBody = accessibilityController.accessibleElementById('body'); |
| window.axParagraph = accessibilityController.accessibleElementById('paragraph'); |
| window.axSpan = accessibilityController.accessibleElementById('span'); |
| }); |
| |
| async_test((t) => { |
| assert_equals(window.axBody.language, 'AXLanguage: en-US', |
| 'The browser language has not been changed yet.'); |
| |
| internals.setUserPreferredLanguages([ 'de' ]); |
| t.step_timeout(() => { |
| assert_equals(window.axBody.language, 'AXLanguage: de', |
| 'The browser language has changed.'); |
| assert_equals(window.axParagraph.language, 'AXLanguage: de', |
| 'The browser language has changed.'); |
| assert_equals(window.axSpan.language, 'AXLanguage: pl', |
| 'The language of the span is controlled by the lang attribute.'); |
| |
| internals.setUserPreferredLanguages(window.languages); |
| t.done(); |
| }, 0); |
| }, 'Tests if the browser language is correctly used to guess the language of the page.'); |
| </script> |
| </body> |
| </html> |