gatsby-core-theme 44.10.0 → 44.10.11
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/.ci.yml +1 -0
- package/CHANGELOG.md +97 -0
- package/gatsby-config.js +3 -3
- package/gatsby-node.mjs +1 -0
- package/package.json +1 -1
- package/src/components/app-ssr.js +16 -18
- package/src/components/atoms/admin/bar/index.js +6 -2
- package/src/components/atoms/admin/button/index.js +4 -3
- package/src/components/atoms/contact-form/index.js +2 -2
- package/src/components/atoms/market-dropdown/index.js +7 -9
- package/src/components/atoms/notifications/index.js +2 -3
- package/src/components/atoms/ratings/index.js +7 -6
- package/src/components/atoms/review-link/index.js +16 -11
- package/src/components/atoms/search/autocomplete/article/index.js +13 -9
- package/src/components/atoms/search/autocomplete/default/index.js +13 -9
- package/src/components/atoms/search/autocomplete/game/index.js +22 -12
- package/src/components/atoms/search/autocomplete/operator/index.js +26 -18
- package/src/components/molecules/bonus/template-one/index.js +15 -2
- package/src/components/molecules/bonus/template-two/index.js +7 -1
- package/src/components/molecules/cookie-modal/index.js +1 -1
- package/src/components/molecules/floating-area/index.js +6 -12
- package/src/components/molecules/footer/index.js +35 -27
- package/src/components/molecules/footer/variants/template-one/template-one.stories.js +70 -67
- package/src/components/molecules/footer/variants/template-one/template-one.test.js +92 -69
- package/src/components/molecules/footer/variants/template-three/template-three.stories.js +4 -4
- package/src/components/molecules/footer/variants/template-three/template-three.test.js +98 -73
- package/src/components/molecules/footer/variants/template-two/template-two.stories.js +3 -3
- package/src/components/molecules/footer/variants/template-two/template-two.test.js +96 -73
- package/src/components/molecules/header/variants/default/template-one/index.js +15 -13
- package/src/components/molecules/header/variants/default/template-one/template-one.test.js +37 -29
- package/src/components/molecules/header/variants/slot/template-one/templateone.test.js +32 -29
- package/src/components/molecules/leave-comment-form/index.js +90 -79
- package/src/components/molecules/main/index.js +5 -7
- package/src/components/molecules/menu/index.js +28 -30
- package/src/components/molecules/newsletter/form/index.js +2 -2
- package/src/components/molecules/newsletter/index.js +23 -19
- package/src/components/molecules/tnc/index.js +4 -2
- package/src/components/organisms/anchor/template-two/index.js +33 -18
- package/src/components/organisms/footer-navigation/index.js +10 -9
- package/src/components/organisms/navigation/index.js +12 -19
- package/src/constants/ratings-constant.js +7 -9
- package/src/helpers/getters.mjs +3 -3
- package/src/helpers/processImageNode.js +38 -30
- package/src/helpers/processImageNode.test.js +33 -24
- package/src/helpers/replaceMedia.js +2 -2
- package/src/resolver/games.mjs +1 -1
- package/src/resolver/operators.mjs +23 -13
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax */
|
|
2
|
-
import React from
|
|
3
|
-
import { render, cleanup, waitFor } from
|
|
4
|
-
import
|
|
5
|
-
import Footer from
|
|
6
|
-
import { getExtraField, copyrightText } from
|
|
7
|
-
import Security from
|
|
8
|
-
import getFooterData from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, cleanup, waitFor } from "@testing-library/react";
|
|
4
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
5
|
+
import Footer from ".";
|
|
6
|
+
import { getExtraField, copyrightText } from "../../../../../helpers/getters";
|
|
7
|
+
import Security from "~images/icons/security";
|
|
8
|
+
import getFooterData from "../../../../../../tests/factories/modules/footer.factory";
|
|
9
9
|
|
|
10
10
|
const helpText = `
|
|
11
11
|
<p>
|
|
@@ -17,7 +17,7 @@ const helpText = `
|
|
|
17
17
|
</a>
|
|
18
18
|
in order to get help.
|
|
19
19
|
</p>`;
|
|
20
|
-
const phoneNum =
|
|
20
|
+
const phoneNum = "- 89 241 5401";
|
|
21
21
|
|
|
22
22
|
const dmcaImg = (
|
|
23
23
|
<img
|
|
@@ -43,18 +43,21 @@ let footerLogos;
|
|
|
43
43
|
|
|
44
44
|
beforeEach(() => {
|
|
45
45
|
data = getFooterData();
|
|
46
|
-
footerMenu = getExtraField(data?.extra_fields,
|
|
47
|
-
asSeenOn = getExtraField(data?.extra_fields,
|
|
48
|
-
gamblingText = getExtraField(data?.extra_fields,
|
|
49
|
-
socialIcons = getExtraField(data?.extra_fields,
|
|
50
|
-
copyrightDisclaimer = getExtraField(
|
|
51
|
-
|
|
46
|
+
footerMenu = getExtraField(data?.extra_fields, "links");
|
|
47
|
+
asSeenOn = getExtraField(data?.extra_fields, "as_seen_on");
|
|
48
|
+
gamblingText = getExtraField(data?.extra_fields, "gambling_text");
|
|
49
|
+
socialIcons = getExtraField(data?.extra_fields, "social_icons");
|
|
50
|
+
copyrightDisclaimer = getExtraField(
|
|
51
|
+
data.extra_fields,
|
|
52
|
+
"copyright_disclaimer"
|
|
53
|
+
);
|
|
54
|
+
footerLogos = getExtraField(data?.extra_fields, "logos");
|
|
52
55
|
|
|
53
56
|
props = {
|
|
54
57
|
section: data,
|
|
55
|
-
template:
|
|
58
|
+
template: "default",
|
|
56
59
|
hasFooterLinks: false,
|
|
57
|
-
footerTemplate:
|
|
60
|
+
footerTemplate: "template_one",
|
|
58
61
|
showLinks: true,
|
|
59
62
|
copyrightDisclaimer,
|
|
60
63
|
footerLogos,
|
|
@@ -64,79 +67,89 @@ beforeEach(() => {
|
|
|
64
67
|
socialIcons,
|
|
65
68
|
hasDisclaimer: true,
|
|
66
69
|
showCopyright: true,
|
|
67
|
-
logo:
|
|
70
|
+
logo: "/images/logo.svg",
|
|
68
71
|
securityIcon: <Security />,
|
|
69
72
|
helpText,
|
|
70
73
|
phoneNum,
|
|
71
74
|
dmcaImg,
|
|
72
75
|
};
|
|
73
76
|
});
|
|
74
|
-
describe(
|
|
75
|
-
test(
|
|
77
|
+
describe("Show Footer", () => {
|
|
78
|
+
test("render with props", () => {
|
|
76
79
|
const { container } = renderComponent(props);
|
|
77
80
|
expect(container).toBeTruthy();
|
|
78
81
|
});
|
|
79
|
-
test(
|
|
82
|
+
test("show correct template ", async () => {
|
|
80
83
|
const { container } = renderComponent(props);
|
|
81
84
|
await waitFor(() => {
|
|
82
|
-
expect(container.querySelectorAll(
|
|
85
|
+
expect(container.querySelectorAll(".footer.templateOne").length).toBe(1);
|
|
83
86
|
});
|
|
84
87
|
});
|
|
85
|
-
test(
|
|
88
|
+
test("show as seen on", async () => {
|
|
86
89
|
const { container, getByText } = renderComponent(props);
|
|
87
90
|
await waitFor(() => {
|
|
88
|
-
expect(container.querySelectorAll(
|
|
89
|
-
expect(container.querySelectorAll(
|
|
91
|
+
expect(container.querySelectorAll("footer > div")).toHaveLength(2);
|
|
92
|
+
expect(container.querySelectorAll(".asSeenOn")).toHaveLength(1);
|
|
90
93
|
|
|
91
94
|
// show correct title
|
|
92
|
-
expect(getByText(
|
|
95
|
+
expect(getByText("As Seen On:")).toHaveTextContent(`${asSeenOn.title}:`);
|
|
93
96
|
|
|
94
97
|
// show correct number of logos
|
|
95
|
-
expect(container.querySelectorAll(
|
|
98
|
+
expect(container.querySelectorAll(".asSeenOn li")).toHaveLength(3);
|
|
96
99
|
});
|
|
97
100
|
});
|
|
98
101
|
|
|
99
|
-
test(
|
|
102
|
+
test("render menu list", async () => {
|
|
100
103
|
const { container, getByText } = renderComponent(props);
|
|
101
104
|
|
|
102
105
|
await waitFor(() => {
|
|
103
|
-
expect(container.querySelectorAll(
|
|
104
|
-
expect(container.querySelectorAll(
|
|
105
|
-
expect(container.querySelectorAll(
|
|
106
|
+
expect(container.querySelectorAll(".topPart")).toHaveLength(1);
|
|
107
|
+
expect(container.querySelectorAll(".links")).toHaveLength(1);
|
|
108
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(
|
|
109
|
+
footerMenu.children.length
|
|
110
|
+
);
|
|
106
111
|
|
|
107
112
|
// show correct title
|
|
108
113
|
expect(getByText(footerMenu.children[0].title)).toBeTruthy();
|
|
109
114
|
expect(getByText(footerMenu.children[2].title)).toBeTruthy();
|
|
110
115
|
|
|
111
116
|
// show correct number of child lists
|
|
112
|
-
expect(
|
|
113
|
-
|
|
117
|
+
expect(
|
|
118
|
+
getByText(footerMenu.children[1].title).closest("ul").children
|
|
119
|
+
).toHaveLength(7);
|
|
120
|
+
expect(
|
|
121
|
+
getByText(footerMenu.children[3].title).closest("ul").children
|
|
122
|
+
).toHaveLength(5);
|
|
114
123
|
|
|
115
124
|
// show correct url
|
|
116
125
|
expect(
|
|
117
|
-
getByText(footerMenu.children[1].children[0].title)
|
|
126
|
+
getByText(footerMenu.children[1].children[0].title)
|
|
127
|
+
.closest("a")
|
|
128
|
+
.getAttribute("href")
|
|
118
129
|
).toEqual(`/${footerMenu.children[1].children[0].value}`);
|
|
119
130
|
expect(
|
|
120
|
-
getByText(footerMenu.children[2].children[2].title)
|
|
131
|
+
getByText(footerMenu.children[2].children[2].title)
|
|
132
|
+
.closest("a")
|
|
133
|
+
.getAttribute("href")
|
|
121
134
|
).toEqual(`/${footerMenu.children[2].children[2].value}`);
|
|
122
135
|
});
|
|
123
136
|
});
|
|
124
|
-
test(
|
|
137
|
+
test("hide menu list", async () => {
|
|
125
138
|
props = {
|
|
126
139
|
...props,
|
|
127
140
|
showLinks: false,
|
|
128
141
|
};
|
|
129
142
|
const { container } = renderComponent(props);
|
|
130
143
|
await waitFor(() => {
|
|
131
|
-
expect(container.querySelectorAll(
|
|
132
|
-
expect(container.querySelectorAll(
|
|
144
|
+
expect(container.querySelectorAll(".links")).toHaveLength(0);
|
|
145
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(0);
|
|
133
146
|
});
|
|
134
147
|
});
|
|
135
|
-
test(
|
|
148
|
+
test("hide gambling text", async () => {
|
|
136
149
|
const { container } = renderComponent(props);
|
|
137
150
|
await waitFor(() => {
|
|
138
|
-
expect(container.querySelectorAll(
|
|
139
|
-
expect(container.querySelectorAll(
|
|
151
|
+
expect(container.querySelectorAll(".license > div")).toHaveLength(3);
|
|
152
|
+
expect(container.querySelectorAll(".gamblingText")).toHaveLength(0);
|
|
140
153
|
});
|
|
141
154
|
});
|
|
142
155
|
// test('correct security text', async () => {
|
|
@@ -149,72 +162,82 @@ describe('Show Footer', () => {
|
|
|
149
162
|
// ).toContain('securityText');
|
|
150
163
|
// });
|
|
151
164
|
// });
|
|
152
|
-
test(
|
|
165
|
+
test("footer middle part does not show another as seen on", async () => {
|
|
153
166
|
const { container } = renderComponent(props);
|
|
154
167
|
await waitFor(() => {
|
|
155
|
-
expect(container.querySelectorAll(
|
|
156
|
-
|
|
168
|
+
expect(container.querySelectorAll(".footerHotline > div")).toHaveLength(
|
|
169
|
+
1
|
|
170
|
+
);
|
|
171
|
+
expect(
|
|
172
|
+
container.querySelectorAll(".footerHotline .asSeenOn")
|
|
173
|
+
).toHaveLength(0);
|
|
157
174
|
});
|
|
158
175
|
});
|
|
159
|
-
test(
|
|
176
|
+
test("correct help text", async () => {
|
|
160
177
|
const { container } = renderComponent(props);
|
|
161
178
|
await waitFor(() => {
|
|
162
|
-
expect(container.querySelector(
|
|
163
|
-
expect(container.querySelector(
|
|
179
|
+
expect(container.querySelector(".helpText")).toBeTruthy();
|
|
180
|
+
expect(container.querySelector(".helpText").innerHTML).toBe(helpText);
|
|
164
181
|
});
|
|
165
182
|
});
|
|
166
|
-
test(
|
|
183
|
+
test("correct phone number", async () => {
|
|
167
184
|
const { getByText, container } = renderComponent(props);
|
|
168
185
|
await waitFor(() => {
|
|
169
186
|
expect(getByText(phoneNum)).toBeTruthy();
|
|
170
|
-
expect(
|
|
187
|
+
expect(
|
|
188
|
+
container.querySelector(".phoneNum").innerHTML.split("</svg>")[1]
|
|
189
|
+
).toBe(phoneNum);
|
|
171
190
|
});
|
|
172
191
|
});
|
|
173
|
-
test(
|
|
192
|
+
test("show copyright disclaimer", async () => {
|
|
174
193
|
const { container } = renderComponent(props);
|
|
175
194
|
await waitFor(() => {
|
|
176
|
-
expect(container.querySelectorAll(
|
|
195
|
+
expect(container.querySelectorAll(".copyrightDisclaimer")).toBeTruthy();
|
|
177
196
|
|
|
178
|
-
expect(container.querySelector(
|
|
197
|
+
expect(container.querySelector(".copyrightDisclaimer").innerHTML).toBe(
|
|
198
|
+
copyrightDisclaimer
|
|
199
|
+
);
|
|
179
200
|
});
|
|
180
201
|
});
|
|
181
|
-
test(
|
|
202
|
+
test("show copyright", async () => {
|
|
182
203
|
const { container } = renderComponent(props);
|
|
183
204
|
await waitFor(() => {
|
|
184
|
-
expect(container.querySelector(
|
|
205
|
+
expect(container.querySelector(".copyrightText")).toHaveTextContent(
|
|
206
|
+
copyrightText()
|
|
207
|
+
);
|
|
185
208
|
});
|
|
186
209
|
});
|
|
187
|
-
test(
|
|
210
|
+
test("hide copyright", async () => {
|
|
188
211
|
props = {
|
|
189
212
|
...props,
|
|
190
213
|
showCopyright: false,
|
|
191
214
|
};
|
|
192
215
|
const { container } = renderComponent(props);
|
|
193
216
|
await waitFor(() => {
|
|
194
|
-
expect(container.querySelector(
|
|
217
|
+
expect(container.querySelector(".copyrightText")).toBeFalsy();
|
|
195
218
|
});
|
|
196
219
|
});
|
|
197
|
-
test(
|
|
220
|
+
test("show dmca image", async () => {
|
|
198
221
|
// eslint-disable-next-line global-require
|
|
199
|
-
const func = require(
|
|
222
|
+
const func = require("~helpers/device-detect");
|
|
200
223
|
func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
|
|
201
224
|
props = {
|
|
202
225
|
...props,
|
|
203
226
|
showCopyright: false,
|
|
204
|
-
dmcaImage:
|
|
227
|
+
dmcaImage: "/images/dmca.png",
|
|
205
228
|
};
|
|
206
229
|
const { container } = renderComponent(props);
|
|
207
|
-
expect(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
);
|
|
230
|
+
expect(
|
|
231
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
232
|
+
).toBeTruthy();
|
|
233
|
+
expect(
|
|
234
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
235
|
+
).toHaveAttribute("src", "/images/dmca.png");
|
|
236
|
+
expect(
|
|
237
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
238
|
+
).toHaveAttribute("loading", "lazy");
|
|
216
239
|
});
|
|
217
|
-
test(
|
|
240
|
+
test("hide dmca image", async () => {
|
|
218
241
|
props = {
|
|
219
242
|
...props,
|
|
220
243
|
hasDisclaimer: false,
|
|
@@ -222,7 +245,7 @@ describe('Show Footer', () => {
|
|
|
222
245
|
};
|
|
223
246
|
const { container } = renderComponent(props);
|
|
224
247
|
await waitFor(() => {
|
|
225
|
-
expect(container.querySelector(
|
|
248
|
+
expect(container.querySelector(".logos > a")).toBeFalsy();
|
|
226
249
|
});
|
|
227
250
|
});
|
|
228
251
|
});
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
PRIMARY_STORY,
|
|
8
8
|
ArgsTable,
|
|
9
9
|
} from "@storybook/addon-docs/blocks";
|
|
10
|
-
import { getExtraField } from "
|
|
10
|
+
import { getExtraField } from "~helpers/getters";
|
|
11
11
|
import getFooterData from "../../../../../../tests/factories/modules/footer.factory";
|
|
12
|
-
import logo from
|
|
13
|
-
import Security from
|
|
14
|
-
import dmca from
|
|
12
|
+
import logo from "../../../../../../static/images/logo.svg";
|
|
13
|
+
import Security from "~images/icons/security";
|
|
14
|
+
import dmca from "../../../../../../static/images/dmca.png";
|
|
15
15
|
import TemplateThree from ".";
|
|
16
16
|
|
|
17
17
|
const footerData = getFooterData();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax */
|
|
2
|
-
import React from
|
|
3
|
-
import { render, cleanup, waitFor } from
|
|
4
|
-
import
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, cleanup, waitFor } from "@testing-library/react";
|
|
4
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
5
5
|
|
|
6
|
-
import { getExtraField, copyrightText } from
|
|
7
|
-
import MainProvider from
|
|
8
|
-
import getFooterData from
|
|
9
|
-
import Security from
|
|
10
|
-
import TemplateOne from
|
|
6
|
+
import { getExtraField, copyrightText } from "~helpers/getters";
|
|
7
|
+
import MainProvider from "~context/MainProvider";
|
|
8
|
+
import getFooterData from "../../../../../../tests/factories/modules/footer.factory";
|
|
9
|
+
import Security from "~images/icons/security";
|
|
10
|
+
import TemplateOne from ".";
|
|
11
11
|
|
|
12
12
|
const translations = {
|
|
13
|
-
licensed_casinos:
|
|
13
|
+
licensed_casinos: "We only list licensed casinos",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const helpText = `
|
|
@@ -23,7 +23,7 @@ const helpText = `
|
|
|
23
23
|
</a>
|
|
24
24
|
in order to get help.
|
|
25
25
|
</p>`;
|
|
26
|
-
const phoneNum =
|
|
26
|
+
const phoneNum = "- 89 241 5401";
|
|
27
27
|
|
|
28
28
|
const dmcaImg = (
|
|
29
29
|
<img
|
|
@@ -57,18 +57,21 @@ let footerLogos;
|
|
|
57
57
|
|
|
58
58
|
beforeEach(() => {
|
|
59
59
|
data = getFooterData();
|
|
60
|
-
footerMenu = getExtraField(data?.extra_fields,
|
|
61
|
-
asSeenOn = getExtraField(data?.extra_fields,
|
|
62
|
-
gamblingText = getExtraField(data?.extra_fields,
|
|
63
|
-
socialIcons = getExtraField(data?.extra_fields,
|
|
64
|
-
copyrightDisclaimer = getExtraField(
|
|
65
|
-
|
|
60
|
+
footerMenu = getExtraField(data?.extra_fields, "links");
|
|
61
|
+
asSeenOn = getExtraField(data?.extra_fields, "as_seen_on");
|
|
62
|
+
gamblingText = getExtraField(data?.extra_fields, "gambling_text");
|
|
63
|
+
socialIcons = getExtraField(data?.extra_fields, "social_icons");
|
|
64
|
+
copyrightDisclaimer = getExtraField(
|
|
65
|
+
data.extra_fields,
|
|
66
|
+
"copyright_disclaimer"
|
|
67
|
+
);
|
|
68
|
+
footerLogos = getExtraField(data?.extra_fields, "logos");
|
|
66
69
|
|
|
67
70
|
props = {
|
|
68
71
|
section: data,
|
|
69
|
-
template:
|
|
72
|
+
template: "default",
|
|
70
73
|
hasFooterLinks: false,
|
|
71
|
-
footerTemplate:
|
|
74
|
+
footerTemplate: "template_one",
|
|
72
75
|
showLinks: true,
|
|
73
76
|
copyrightDisclaimer,
|
|
74
77
|
footerLogos,
|
|
@@ -78,88 +81,100 @@ beforeEach(() => {
|
|
|
78
81
|
socialIcons,
|
|
79
82
|
hasDisclaimer: true,
|
|
80
83
|
showCopyright: true,
|
|
81
|
-
logo:
|
|
84
|
+
logo: "/images/logo.svg",
|
|
82
85
|
securityIcon: <Security />,
|
|
83
86
|
helpText,
|
|
84
87
|
phoneNum,
|
|
85
88
|
dmcaImg,
|
|
86
89
|
};
|
|
87
90
|
});
|
|
88
|
-
describe(
|
|
89
|
-
test(
|
|
91
|
+
describe("Show template one", () => {
|
|
92
|
+
test("render with props", () => {
|
|
90
93
|
const { container } = renderComponent(props);
|
|
91
94
|
expect(container).toBeTruthy();
|
|
92
95
|
});
|
|
93
|
-
test(
|
|
96
|
+
test("show correct template ", async () => {
|
|
94
97
|
const { container } = renderComponent(props);
|
|
95
98
|
await waitFor(() => {
|
|
96
|
-
expect(container.querySelectorAll(
|
|
99
|
+
expect(container.querySelectorAll(".footer.templateThree").length).toBe(
|
|
100
|
+
1
|
|
101
|
+
);
|
|
97
102
|
});
|
|
98
103
|
});
|
|
99
|
-
test(
|
|
104
|
+
test("show as seen on", async () => {
|
|
100
105
|
const { container, getByText } = renderComponent(props);
|
|
101
106
|
await waitFor(() => {
|
|
102
|
-
expect(container.querySelectorAll(
|
|
103
|
-
expect(container.querySelectorAll(
|
|
107
|
+
expect(container.querySelectorAll("footer > div")).toHaveLength(2);
|
|
108
|
+
expect(container.querySelectorAll(".asSeenOn")).toHaveLength(1);
|
|
104
109
|
|
|
105
110
|
// show correct title
|
|
106
|
-
expect(getByText(
|
|
111
|
+
expect(getByText("As Seen On:")).toHaveTextContent(`${asSeenOn.title}:`);
|
|
107
112
|
|
|
108
113
|
// show correct number of logos
|
|
109
|
-
expect(container.querySelectorAll(
|
|
114
|
+
expect(container.querySelectorAll(".asSeenOn li")).toHaveLength(3);
|
|
110
115
|
});
|
|
111
116
|
});
|
|
112
|
-
test(
|
|
117
|
+
test("hide as seen on", async () => {
|
|
113
118
|
props = {
|
|
114
119
|
...props,
|
|
115
120
|
asSeenOn: null,
|
|
116
121
|
};
|
|
117
122
|
const { container } = renderComponent(props);
|
|
118
123
|
await waitFor(() => {
|
|
119
|
-
expect(container.querySelectorAll(
|
|
124
|
+
expect(container.querySelectorAll("footer > div")).toHaveLength(1);
|
|
120
125
|
});
|
|
121
126
|
});
|
|
122
|
-
test(
|
|
127
|
+
test("render menu list", async () => {
|
|
123
128
|
const { container, getByText } = renderComponent(props);
|
|
124
129
|
|
|
125
130
|
await waitFor(() => {
|
|
126
|
-
expect(container.querySelectorAll(
|
|
127
|
-
expect(container.querySelectorAll(
|
|
128
|
-
expect(container.querySelectorAll(
|
|
131
|
+
expect(container.querySelectorAll(".topPart")).toHaveLength(1);
|
|
132
|
+
expect(container.querySelectorAll(".links")).toHaveLength(1);
|
|
133
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(
|
|
134
|
+
footerMenu.children.length
|
|
135
|
+
);
|
|
129
136
|
|
|
130
137
|
// show correct title
|
|
131
138
|
expect(getByText(footerMenu.children[0].title)).toBeTruthy();
|
|
132
139
|
expect(getByText(footerMenu.children[2].title)).toBeTruthy();
|
|
133
140
|
|
|
134
141
|
// show correct number of child lists
|
|
135
|
-
expect(
|
|
136
|
-
|
|
142
|
+
expect(
|
|
143
|
+
getByText(footerMenu.children[1].title).closest("ul").children
|
|
144
|
+
).toHaveLength(7);
|
|
145
|
+
expect(
|
|
146
|
+
getByText(footerMenu.children[2].title).closest("ul").children
|
|
147
|
+
).toHaveLength(6);
|
|
137
148
|
|
|
138
149
|
// show correct url
|
|
139
150
|
expect(
|
|
140
|
-
getByText(footerMenu.children[1].children[0].title)
|
|
151
|
+
getByText(footerMenu.children[1].children[0].title)
|
|
152
|
+
.closest("a")
|
|
153
|
+
.getAttribute("href")
|
|
141
154
|
).toEqual(`/${footerMenu.children[1].children[0].value}`);
|
|
142
155
|
expect(
|
|
143
|
-
getByText(footerMenu.children[2].children[2].title)
|
|
156
|
+
getByText(footerMenu.children[2].children[2].title)
|
|
157
|
+
.closest("a")
|
|
158
|
+
.getAttribute("href")
|
|
144
159
|
).toEqual(`/${footerMenu.children[2].children[2].value}`);
|
|
145
160
|
});
|
|
146
161
|
});
|
|
147
|
-
test(
|
|
162
|
+
test("hide menu list", async () => {
|
|
148
163
|
props = {
|
|
149
164
|
...props,
|
|
150
165
|
showLinks: null,
|
|
151
166
|
};
|
|
152
167
|
const { container } = renderComponent(props);
|
|
153
168
|
await waitFor(() => {
|
|
154
|
-
expect(container.querySelectorAll(
|
|
155
|
-
expect(container.querySelectorAll(
|
|
169
|
+
expect(container.querySelectorAll(".links")).toHaveLength(0);
|
|
170
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(0);
|
|
156
171
|
});
|
|
157
172
|
});
|
|
158
|
-
test(
|
|
173
|
+
test("hide gambling text", async () => {
|
|
159
174
|
const { container } = renderComponent(props);
|
|
160
175
|
await waitFor(() => {
|
|
161
|
-
expect(container.querySelectorAll(
|
|
162
|
-
expect(container.querySelectorAll(
|
|
176
|
+
expect(container.querySelectorAll(".license > div")).toHaveLength(4);
|
|
177
|
+
expect(container.querySelectorAll(".gamblingText")).toHaveLength(1);
|
|
163
178
|
});
|
|
164
179
|
});
|
|
165
180
|
// test('correct security text', async () => {
|
|
@@ -172,79 +187,89 @@ describe('Show template one', () => {
|
|
|
172
187
|
// ).toContain('securityText');
|
|
173
188
|
// });
|
|
174
189
|
// });
|
|
175
|
-
test(
|
|
190
|
+
test("footer middle part does not show another as seen on", async () => {
|
|
176
191
|
const { container } = renderComponent(props);
|
|
177
192
|
await waitFor(() => {
|
|
178
|
-
expect(container.querySelectorAll(
|
|
179
|
-
|
|
193
|
+
expect(container.querySelectorAll(".footerHotline > div")).toHaveLength(
|
|
194
|
+
1
|
|
195
|
+
);
|
|
196
|
+
expect(
|
|
197
|
+
container.querySelectorAll(".footerHotline .asSeenOn")
|
|
198
|
+
).toHaveLength(0);
|
|
180
199
|
});
|
|
181
200
|
});
|
|
182
|
-
test(
|
|
201
|
+
test("correct help text", async () => {
|
|
183
202
|
const { container } = renderComponent(props);
|
|
184
203
|
await waitFor(() => {
|
|
185
|
-
expect(container.querySelector(
|
|
186
|
-
expect(container.querySelector(
|
|
204
|
+
expect(container.querySelector(".helpText")).toBeTruthy();
|
|
205
|
+
expect(container.querySelector(".helpText").innerHTML).toBe(helpText);
|
|
187
206
|
});
|
|
188
207
|
});
|
|
189
|
-
test(
|
|
208
|
+
test("correct phone number", async () => {
|
|
190
209
|
const { getByText, container } = renderComponent(props);
|
|
191
210
|
await waitFor(() => {
|
|
192
211
|
expect(getByText(phoneNum)).toBeTruthy();
|
|
193
|
-
expect(
|
|
212
|
+
expect(
|
|
213
|
+
container.querySelector(".phoneNum").innerHTML.split("</svg>")[1]
|
|
214
|
+
).toBe(phoneNum);
|
|
194
215
|
});
|
|
195
216
|
});
|
|
196
|
-
test(
|
|
217
|
+
test("show copyright disclaimer", async () => {
|
|
197
218
|
const { container } = renderComponent(props);
|
|
198
219
|
await waitFor(() => {
|
|
199
|
-
expect(container.querySelectorAll(
|
|
220
|
+
expect(container.querySelectorAll(".copyrightDisclaimer")).toBeTruthy();
|
|
200
221
|
|
|
201
|
-
expect(container.querySelector(
|
|
222
|
+
expect(container.querySelector(".copyrightDisclaimer").innerHTML).toBe(
|
|
223
|
+
copyrightDisclaimer
|
|
224
|
+
);
|
|
202
225
|
});
|
|
203
226
|
});
|
|
204
|
-
test(
|
|
227
|
+
test("show copyright", async () => {
|
|
205
228
|
const { container } = renderComponent(props);
|
|
206
229
|
await waitFor(() => {
|
|
207
|
-
expect(container.querySelector(
|
|
230
|
+
expect(container.querySelector(".copyrightText")).toHaveTextContent(
|
|
231
|
+
copyrightText()
|
|
232
|
+
);
|
|
208
233
|
});
|
|
209
234
|
});
|
|
210
|
-
test(
|
|
235
|
+
test("hide copyright", async () => {
|
|
211
236
|
props = {
|
|
212
237
|
...props,
|
|
213
238
|
showCopyright: false,
|
|
214
239
|
};
|
|
215
240
|
const { container } = renderComponent(props);
|
|
216
241
|
await waitFor(() => {
|
|
217
|
-
expect(container.querySelector(
|
|
242
|
+
expect(container.querySelector(".copyrightText")).toBeFalsy();
|
|
218
243
|
});
|
|
219
244
|
});
|
|
220
|
-
test(
|
|
245
|
+
test("show dmca image", async () => {
|
|
221
246
|
// eslint-disable-next-line global-require
|
|
222
|
-
const func = require(
|
|
247
|
+
const func = require("~helpers/device-detect");
|
|
223
248
|
func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
|
|
224
249
|
props = {
|
|
225
250
|
...props,
|
|
226
251
|
showCopyright: false,
|
|
227
|
-
dmcaImage:
|
|
252
|
+
dmcaImage: "/images/dmca.png",
|
|
228
253
|
};
|
|
229
254
|
const { container } = renderComponent(props);
|
|
230
|
-
expect(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
);
|
|
255
|
+
expect(
|
|
256
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
257
|
+
).toBeTruthy();
|
|
258
|
+
expect(
|
|
259
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
260
|
+
).toHaveAttribute("src", "/images/dmca.png");
|
|
261
|
+
expect(
|
|
262
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
263
|
+
).toHaveAttribute("loading", "lazy");
|
|
239
264
|
});
|
|
240
|
-
test(
|
|
265
|
+
test("hide dmca image", async () => {
|
|
241
266
|
props = {
|
|
242
267
|
...props,
|
|
243
268
|
hasDisclaimer: false,
|
|
244
269
|
};
|
|
245
270
|
const { container } = renderComponent(props);
|
|
246
271
|
await waitFor(() => {
|
|
247
|
-
expect(container.querySelector(
|
|
272
|
+
expect(container.querySelector(".logos > a")).toBeFalsy();
|
|
248
273
|
});
|
|
249
274
|
});
|
|
250
275
|
});
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
PRIMARY_STORY,
|
|
8
8
|
ArgsTable,
|
|
9
9
|
} from "@storybook/addon-docs/blocks";
|
|
10
|
-
import { getExtraField } from "
|
|
10
|
+
import { getExtraField } from "~helpers/getters";
|
|
11
11
|
import getFooterData from "../../../../../../tests/factories/modules/footer.factory";
|
|
12
|
-
import dmca from
|
|
12
|
+
import dmca from "../../../../../../static/images/dmca.png";
|
|
13
13
|
import logo from "../../../../../../static/images/logo.svg";
|
|
14
|
-
import Security from
|
|
14
|
+
import Security from "~images/icons/security";
|
|
15
15
|
import TemplateTwo from ".";
|
|
16
16
|
|
|
17
17
|
const footerData = getFooterData();
|