summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/chrome/test_intlUtils_isAppLocaleRTL.html
blob: fc6e8e2fb4a29ddec778b1cdad8335874a3927f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1673054
-->
<head>
  <title>Test for Bug 1673054 </title>
  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body onload="test()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1673054 ">Mozilla Bug 1673054</a>
<p id="display"></p>
<div id="content" style="display: none">
<script>
async function test() {
  SimpleTest.waitForExplicitFinish();

  let intlUtils = window.intlUtils;
  ok(intlUtils, "window.intlUtils should exist");

  let originalValue = intlUtils.isAppLocaleRTL();
  ok(originalValue == false, "window.intlUtils.isAppLocaleRTL should exist");

  await SpecialPowers.pushPrefEnv({ set: [["intl.l10n.pseudo", "bidi"]] });
  let currentValue = intlUtils.isAppLocaleRTL();
  ok(currentValue == true, "If pseudolocale is bidi, isAppLocaleRTL should be true");

  await SpecialPowers.clearUserPref("intl.l10n.pseudo");
  currentValue = intlUtils.isAppLocaleRTL();
  ok(originalValue == currentValue, "Without override, isAppLocaleRTL should be default");

  SimpleTest.finish();
}
</script>
</body>
</html>