summaryrefslogtreecommitdiffstats
path: root/dom/l10n/tests/mochitest/dom_localization/test_getAttributes.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/l10n/tests/mochitest/dom_localization/test_getAttributes.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/l10n/tests/mochitest/dom_localization/test_getAttributes.html')
-rw-r--r--dom/l10n/tests/mochitest/dom_localization/test_getAttributes.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/dom/l10n/tests/mochitest/dom_localization/test_getAttributes.html b/dom/l10n/tests/mochitest/dom_localization/test_getAttributes.html
new file mode 100644
index 0000000000..11996d132a
--- /dev/null
+++ b/dom/l10n/tests/mochitest/dom_localization/test_getAttributes.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test DOMLocalization.prototype.getAttributes</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">
+ <script type="application/javascript">
+ "use strict";
+
+ window.onload = function() {
+ SimpleTest.waitForExplicitFinish();
+
+ const domLoc = new DOMLocalization(
+ [],
+ false,
+ );
+
+ const p1 = document.querySelectorAll("p")[0];
+ const p2 = document.querySelectorAll("p")[1];
+ const p3 = document.querySelectorAll("p")[2];
+ const attrs1 = domLoc.getAttributes(p1);
+ const attrs2 = domLoc.getAttributes(p2);
+ const attrs3 = domLoc.getAttributes(p3);
+ isDeeply(attrs1, {
+ id: null,
+ args: null,
+ });
+ isDeeply(attrs2, {
+ id: "id1",
+ args: null,
+ });
+ isDeeply(attrs3, {
+ id: "id2",
+ args: {
+ userName: "John",
+ },
+ });
+
+ SimpleTest.finish();
+ };
+ </script>
+</head>
+<body>
+ <p />
+ <p data-l10n-id="id1" />
+ <p data-l10n-id="id2" data-l10n-args='{"userName": "John"}' />
+</body>
+</html>