test_overlay_missing_all.html (1034B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test DOMLocalization's DOMOverlay functionality</title> 6 <script 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 <script type="application/javascript"> 9 "use strict"; 10 const l10nReg = new L10nRegistry(); 11 12 SimpleTest.waitForExplicitFinish(); 13 addLoadEvent(async () => { 14 const domLoc = new DOMLocalization( 15 [], 16 false, 17 l10nReg, 18 ["en-US"], 19 ); 20 21 await domLoc.translateFragment(document.body).then(() => { 22 ok(false, "Expected translateFragment to throw on missing l10n-id"); 23 }, () => { 24 ok(true, "Expected translateFragment to throw on missing l10n-id"); 25 }); 26 SimpleTest.finish(); 27 }); 28 </script> 29 </head> 30 <body> 31 <p data-l10n-id="title"> 32 <a href="http://www.mozilla.org"></a> 33 <a href="http://www.firefox.com"></a> 34 <a href="http://www.w3.org"></a> 35 </p> 36 </body> 37 </html>