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/HelpText.test.jsx      | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 browser/components/aboutwelcome/tests/unit/HelpText.test.jsx

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

diff --git a/browser/components/aboutwelcome/tests/unit/HelpText.test.jsx b/browser/components/aboutwelcome/tests/unit/HelpText.test.jsx
new file mode 100644
index 0000000000..e9b722b9d8
--- /dev/null
+++ b/browser/components/aboutwelcome/tests/unit/HelpText.test.jsx
@@ -0,0 +1,41 @@
+import { HelpText } from "content-src/components/HelpText";
+import { Localized } from "content-src/components/MSLocalized";
+import React from "react";
+import { shallow } from "enzyme";
+
+describe("<HelpText>", () => {
+  it("should render text inside Localized", () => {
+    const shallowWrapper = shallow(<HelpText text="test" />);
+
+    assert.equal(shallowWrapper.find(Localized).props().text, "test");
+  });
+  it("should render the img if there is an img and a string_id", () => {
+    const shallowWrapper = shallow(
+      <HelpText
+        text={{ string_id: "test_id" }}
+        hasImg={{
+          src: "chrome://activity-stream/content/data/content/assets/cfr_fb_container.png",
+        }}
+      />
+    );
+    assert.ok(
+      shallowWrapper
+        .find(Localized)
+        .findWhere(n => n.text.string_id === "test_id")
+    );
+    assert.lengthOf(shallowWrapper.find("p.helptext"), 1);
+    assert.lengthOf(shallowWrapper.find("img[data-l10n-name='help-img']"), 1);
+  });
+  it("should render the img if there is an img and plain text", () => {
+    const shallowWrapper = shallow(
+      <HelpText
+        text={"Sample help text"}
+        hasImg={{
+          src: "chrome://activity-stream/content/data/content/assets/cfr_fb_container.png",
+        }}
+      />
+    );
+    assert.equal(shallowWrapper.find("p.helptext").text(), "Sample help text");
+    assert.lengthOf(shallowWrapper.find("img.helptext-img"), 1);
+  });
+});
-- 
cgit v1.2.3

