summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/node/components/message-icon.test.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/webconsole/test/node/components/message-icon.test.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/webconsole/test/node/components/message-icon.test.js')
-rw-r--r--devtools/client/webconsole/test/node/components/message-icon.test.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/node/components/message-icon.test.js b/devtools/client/webconsole/test/node/components/message-icon.test.js
new file mode 100644
index 0000000000..7d4a8a3b23
--- /dev/null
+++ b/devtools/client/webconsole/test/node/components/message-icon.test.js
@@ -0,0 +1,47 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+const {
+ MESSAGE_LEVEL,
+} = require("resource://devtools/client/webconsole/constants.js");
+
+const expect = require("expect");
+const { render } = require("enzyme");
+const {
+ createFactory,
+} = require("resource://devtools/client/shared/vendor/react.js");
+const MessageIcon = createFactory(
+ require("resource://devtools/client/webconsole/components/Output/MessageIcon.js")
+);
+
+describe("MessageIcon component:", () => {
+ it("renders icon based on level", () => {
+ const rendered = render(MessageIcon({ level: MESSAGE_LEVEL.ERROR }));
+ expect(rendered.hasClass("icon")).toBe(true);
+ expect(rendered.attr("title")).toBe("Error");
+ expect(rendered.attr("aria-live")).toBe("off");
+ });
+
+ it("renders logpoint items", () => {
+ const rendered = render(
+ MessageIcon({
+ level: MESSAGE_LEVEL.LOG,
+ type: "logPoint",
+ })
+ );
+ expect(rendered.hasClass("logpoint")).toBe(true);
+ });
+
+ it("renders icon with custom title", () => {
+ const expectedTitle = "Rendered with custom title";
+ const rendered = render(
+ MessageIcon({
+ level: MESSAGE_LEVEL.INFO,
+ type: "info",
+ title: expectedTitle,
+ })
+ );
+ expect(rendered.attr("title")).toBe(expectedTitle);
+ });
+});