gatsby-core-theme 44.0.42 → 44.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# [44.1.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.42...v44.1.0) (2025-05-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
* Merge branch 'tm-5470-custom-logo-alt' into 'master' ([51d98bb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/51d98bb106549c47f61540780a5efd592202b67e))
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* custom logo alt ([ddf1164](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ddf1164ea20a2143dff63a97fff5083293b9bcb8))
|
|
10
|
+
|
|
1
11
|
## [44.0.42](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.41...v44.0.42) (2025-05-21)
|
|
2
12
|
|
|
3
13
|
|
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@ const Navigation = ({
|
|
|
26
26
|
stopScrollOnOpen = true,
|
|
27
27
|
canOpenAllSubMenus = true,
|
|
28
28
|
logo = "/images/logo.svg",
|
|
29
|
+
logoAlt = `${process.env.GATSBY_SITE_NAME} logo`,
|
|
29
30
|
logoWidth = 200,
|
|
30
31
|
logoHeight = 31,
|
|
31
32
|
searchIcon = null,
|
|
@@ -39,7 +40,6 @@ const Navigation = ({
|
|
|
39
40
|
megaMenu = false,
|
|
40
41
|
menu,
|
|
41
42
|
}) => {
|
|
42
|
-
|
|
43
43
|
const navRef = useRef(React.createRef());
|
|
44
44
|
const { admin } = useContext(Context) || {};
|
|
45
45
|
const showMenu =
|
|
@@ -54,12 +54,7 @@ const Navigation = ({
|
|
|
54
54
|
pageTypes[template]?.showLogoWithLink ?? pageTypes.default.showLogoWithLink;
|
|
55
55
|
|
|
56
56
|
const logoImg = (
|
|
57
|
-
<img
|
|
58
|
-
alt={`${process.env.GATSBY_SITE_NAME} logo`}
|
|
59
|
-
src={logo}
|
|
60
|
-
width={logoWidth}
|
|
61
|
-
height={logoHeight}
|
|
62
|
-
/>
|
|
57
|
+
<img alt={logoAlt} src={logo} width={logoWidth} height={logoHeight} />
|
|
63
58
|
);
|
|
64
59
|
|
|
65
60
|
if (stopScrollOnOpen) toggleScroll("", true);
|
|
@@ -135,7 +130,9 @@ const Navigation = ({
|
|
|
135
130
|
/>
|
|
136
131
|
|
|
137
132
|
<div className={styles.navIconContainer}>
|
|
138
|
-
{activeMarket && !disableMarketDropdown &&
|
|
133
|
+
{activeMarket && !disableMarketDropdown && (
|
|
134
|
+
<MarketDropdown pageContext={pageContext} />
|
|
135
|
+
)}
|
|
139
136
|
{showNotifications && <Notifications section={section} />}
|
|
140
137
|
{hasCustomComponent && (
|
|
141
138
|
<CustomComponent
|
|
@@ -205,6 +202,7 @@ Navigation.propTypes = {
|
|
|
205
202
|
megaMenu: PropTypes.bool,
|
|
206
203
|
menu: PropTypes.string,
|
|
207
204
|
logo: PropTypes.string,
|
|
205
|
+
logoAlt: PropTypes.string,
|
|
208
206
|
logoWidth: PropTypes.number,
|
|
209
207
|
logoHeight: PropTypes.number,
|
|
210
208
|
};
|
|
@@ -1,43 +1,86 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, cleanup, waitFor } from
|
|
3
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, cleanup, waitFor } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
4
4
|
|
|
5
|
-
import { getNavigationMenus } from
|
|
6
|
-
import getPageData from
|
|
7
|
-
import Navigation from
|
|
5
|
+
import { getNavigationMenus } from "~tests/factories/sections/navigation.factory";
|
|
6
|
+
import getPageData from "../../../../tests/factories/pages/default.factory";
|
|
7
|
+
import Navigation from ".";
|
|
8
8
|
|
|
9
9
|
const menuSection = getNavigationMenus(1, 2, true);
|
|
10
|
-
const pageContext = {page: getPageData()}
|
|
11
|
-
describe(
|
|
12
|
-
test(
|
|
13
|
-
const { container } = render(
|
|
10
|
+
const pageContext = { page: getPageData() };
|
|
11
|
+
describe("Navigation Component", () => {
|
|
12
|
+
test("render navigation", async () => {
|
|
13
|
+
const { container } = render(
|
|
14
|
+
<Navigation pageContext={pageContext} section={menuSection} />
|
|
15
|
+
);
|
|
14
16
|
|
|
15
17
|
await waitFor(() => {
|
|
16
|
-
expect(container.querySelectorAll(
|
|
17
|
-
expect(container.querySelectorAll(
|
|
18
|
-
expect(container.querySelectorAll(
|
|
19
|
-
expect(container.querySelectorAll(
|
|
18
|
+
expect(container.querySelectorAll(".nav")).toHaveLength(1);
|
|
19
|
+
expect(container.querySelectorAll(".logo")).toHaveLength(1);
|
|
20
|
+
expect(container.querySelectorAll(".menuContainer")).toHaveLength(1);
|
|
21
|
+
expect(container.querySelectorAll(".search")).toHaveLength(1);
|
|
20
22
|
});
|
|
21
23
|
});
|
|
22
|
-
test(
|
|
23
|
-
const { container } = render(
|
|
24
|
+
test("render navigation when template is ppc", async () => {
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<Navigation
|
|
27
|
+
pageContext={pageContext}
|
|
28
|
+
section={menuSection}
|
|
29
|
+
template="ppc"
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
24
32
|
|
|
25
33
|
await waitFor(() => {
|
|
26
|
-
expect(container.querySelectorAll(
|
|
27
|
-
expect(container.querySelectorAll(
|
|
28
|
-
expect(container.querySelectorAll(
|
|
29
|
-
expect(container.querySelectorAll(
|
|
34
|
+
expect(container.querySelectorAll(".nav")).toHaveLength(1);
|
|
35
|
+
expect(container.querySelectorAll(".logo")).toHaveLength(1);
|
|
36
|
+
expect(container.querySelectorAll(".menuContainer")).toHaveLength(0);
|
|
37
|
+
expect(container.querySelectorAll(".search")).toHaveLength(0);
|
|
30
38
|
});
|
|
31
39
|
});
|
|
32
|
-
test(
|
|
33
|
-
const { container } = render(
|
|
40
|
+
test("render navigation without search", async () => {
|
|
41
|
+
const { container } = render(
|
|
42
|
+
<Navigation
|
|
43
|
+
pageContext={pageContext}
|
|
44
|
+
section={menuSection}
|
|
45
|
+
hasSearch={false}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
34
48
|
|
|
35
49
|
await waitFor(() => {
|
|
36
|
-
expect(container.querySelectorAll(
|
|
37
|
-
expect(container.querySelectorAll(
|
|
38
|
-
expect(container.querySelectorAll(
|
|
50
|
+
expect(container.querySelectorAll(".nav")).toHaveLength(1);
|
|
51
|
+
expect(container.querySelectorAll(".menuContainer")).toHaveLength(1);
|
|
52
|
+
expect(container.querySelectorAll(".search")).toHaveLength(0);
|
|
39
53
|
});
|
|
40
54
|
});
|
|
55
|
+
test("render navigation with custom logo alt", async () => {
|
|
56
|
+
const { container } = render(
|
|
57
|
+
<Navigation
|
|
58
|
+
pageContext={pageContext}
|
|
59
|
+
section={menuSection}
|
|
60
|
+
hasSearch={false}
|
|
61
|
+
logoAlt="custom logo alt"
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(container.querySelectorAll("img")[0]).toHaveProperty(
|
|
66
|
+
"alt",
|
|
67
|
+
"custom logo alt"
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
test("render navigation with default logo alt", async () => {
|
|
71
|
+
const { container } = render(
|
|
72
|
+
<Navigation
|
|
73
|
+
pageContext={pageContext}
|
|
74
|
+
section={menuSection}
|
|
75
|
+
hasSearch={false}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
expect(container.querySelectorAll("img")[0]).toHaveProperty(
|
|
80
|
+
"alt",
|
|
81
|
+
`${process.env.GATSBY_SITE_NAME} logo`
|
|
82
|
+
);
|
|
83
|
+
});
|
|
41
84
|
});
|
|
42
85
|
afterEach(() => {
|
|
43
86
|
cleanup();
|