From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Fri, 19 Apr 2024 02:47:55 +0200
Subject: Adding upstream version 124.0.1.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 .../aboutwelcome/tests/unit/MSLocalized.test.jsx   | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 browser/components/aboutwelcome/tests/unit/MSLocalized.test.jsx

(limited to 'browser/components/aboutwelcome/tests/unit/MSLocalized.test.jsx')

diff --git a/browser/components/aboutwelcome/tests/unit/MSLocalized.test.jsx b/browser/components/aboutwelcome/tests/unit/MSLocalized.test.jsx
new file mode 100644
index 0000000000..57f7e5526c
--- /dev/null
+++ b/browser/components/aboutwelcome/tests/unit/MSLocalized.test.jsx
@@ -0,0 +1,48 @@
+import { Localized } from "content-src/components/MSLocalized";
+import React from "react";
+import { shallow } from "enzyme";
+
+describe("<MSLocalized>", () => {
+  it("should render span with no children", () => {
+    const shallowWrapper = shallow(<Localized text="test" />);
+
+    assert.ok(shallowWrapper.find("span").exists());
+    assert.equal(shallowWrapper.text(), "test");
+  });
+  it("should render span when using string_id with no children", () => {
+    const shallowWrapper = shallow(
+      <Localized text={{ string_id: "test_id" }} />
+    );
+
+    assert.ok(shallowWrapper.find("span[data-l10n-id='test_id']").exists());
+  });
+  it("should render text inside child", () => {
+    const shallowWrapper = shallow(
+      <Localized text="test">
+        <div />
+      </Localized>
+    );
+
+    assert.ok(shallowWrapper.find("div").text(), "test");
+  });
+  it("should use l10n id on child", () => {
+    const shallowWrapper = shallow(
+      <Localized text={{ string_id: "test_id" }}>
+        <div />
+      </Localized>
+    );
+
+    assert.ok(shallowWrapper.find("div[data-l10n-id='test_id']").exists());
+  });
+  it("should keep original children", () => {
+    const shallowWrapper = shallow(
+      <Localized text={{ string_id: "test_id" }}>
+        <h1>
+          <span data-l10n-name="test" />
+        </h1>
+      </Localized>
+    );
+
+    assert.ok(shallowWrapper.find("span[data-l10n-name='test']").exists());
+  });
+});
-- 
cgit v1.2.3

