tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_template.html (1254B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test L10n Mutations in Template elements</title>
      6  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
      8  <link rel="localization" href="crashreporter/aboutcrashes.ftl"/>
      9  <script type="application/javascript">
     10  "use strict";
     11  SimpleTest.waitForExplicitFinish();
     12 
     13  document.addEventListener("DOMContentLoaded", async () => {
     14    await document.l10n.ready;
     15    let template = document.getElementById("template");
     16    let clone = document.importNode(template.content, true);
     17    let span = clone.querySelector("span");
     18    is(span.textContent.length, 0,
     19      "Element has not been translated while in template");
     20    document.body.appendChild(clone);
     21 
     22    let verifyL10n = () => {
     23      if (span.textContent.length) {
     24        window.removeEventListener("MozAfterPaint", verifyL10n);
     25        SimpleTest.finish();
     26      }
     27    };
     28    window.addEventListener("MozAfterPaint", verifyL10n);
     29  });
     30  </script>
     31 </head>
     32 <body>
     33  <template id="template">
     34    <span data-l10n-id="crash-reports-title"></span>
     35  </template>
     36 </body>
     37 </html>