gatsby-matrix-theme 3.2.23 → 3.2.27
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 +56 -0
- package/gatsby-config.js +1 -2
- package/jest.config.js +1 -1
- package/package.json +2 -2
- package/src/components/atoms/author-card/author-card.test.js +7 -0
- package/src/components/atoms/cards/comparison-table/table/index.js +17 -7
- package/src/components/atoms/cards/comparison-table/table/table.test.js +57 -5
- package/src/components/atoms/cards/game-card/index.js +11 -9
- package/src/components/atoms/social-icons/social-icons.test.js +8 -0
- package/src/components/molecules/carousel/screenshot-slide/screenshot-slide.test.js +6 -0
- package/src/components/molecules/faq/faq.module.scss +2 -0
- package/src/components/molecules/faq/index.js +8 -8
- package/src/components/molecules/header/header.test.js +87 -0
- package/src/components/molecules/header/index.js +28 -28
- package/src/components/molecules/operator-summary/operator-summary.test.js +24 -0
- package/src/components/molecules/toplist/row/variant-one.js +5 -1
- package/src/components/molecules/toplist/row/variant-one.test.js +16 -0
- package/src/components/pages/contact-us/index.js +1 -0
- package/src/gatsby-core-theme/components/atoms/module-title/index.js +11 -14
- package/src/gatsby-core-theme/components/molecules/content/index.js +7 -7
- package/src/gatsby-core-theme/components/pages/body/index.js +20 -1
- package/storybook/public/{1.ac251b98.iframe.bundle.js → 1.2a2b1ee2.iframe.bundle.js} +1 -1
- package/storybook/public/{5.7148fbb6.iframe.bundle.js → 5.6967d34e.iframe.bundle.js} +3 -3
- package/storybook/public/{5.7148fbb6.iframe.bundle.js.LICENSE.txt → 5.6967d34e.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/5.6967d34e.iframe.bundle.js.map +1 -0
- package/storybook/public/{6.ad9d9402.iframe.bundle.js → 6.892dc208.iframe.bundle.js} +1 -1
- package/storybook/public/{7.a5b95b83.iframe.bundle.js → 7.061faab7.iframe.bundle.js} +1 -1
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/main.08905184.iframe.bundle.js +1 -0
- package/storybook/public/{runtime~main.59fc7233.iframe.bundle.js → runtime~main.3d3135a4.iframe.bundle.js} +1 -1
- package/storybook/public/{vendors~main.73d094d3.iframe.bundle.js → vendors~main.0a927976.iframe.bundle.js} +4 -4
- package/storybook/public/{vendors~main.73d094d3.iframe.bundle.js.LICENSE.txt → vendors~main.0a927976.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook/public/vendors~main.0a927976.iframe.bundle.js.map +1 -0
- package/tests/factories/modules/matrix/card.factory.js +310 -78
- package/storybook/public/5.7148fbb6.iframe.bundle.js.map +0 -1
- package/storybook/public/main.1fb3ac74.iframe.bundle.js +0 -1
- package/storybook/public/vendors~main.73d094d3.iframe.bundle.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
## [3.2.27](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.26...v3.2.27) (2022-02-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* added canary token script ([af5479f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/af5479fa3e9814baf9a06368a560754d10f0f49e))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Config
|
|
10
|
+
|
|
11
|
+
* updated to latest core version ([bc48d27](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/bc48d277b3dba149aeeffdaff490b8715320f288))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/matrix-theme ([23020a5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/23020a5036887d5570c1958820c4de74b211a938))
|
|
15
|
+
* Merge branch 'tm-2681-canary-tokens' into 'master' ([49fca6c](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/49fca6ced00281ce2a4a17f93b927179fddbf8ff))
|
|
16
|
+
|
|
17
|
+
## [3.2.26](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.25...v3.2.26) (2022-02-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* removing unused divs ([7f5bc6d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7f5bc6dcc182d025117e2005c3973f41973588f3))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/matrix-theme ([f704c0b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f704c0b58a8a8e124790281ad36637454216bdde))
|
|
26
|
+
|
|
27
|
+
## [3.2.25](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.24...v3.2.25) (2022-02-07)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* clean up gatsby config ([5c2f4df](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5c2f4df24fce6888fe8222084c7d7c5cd7b1f9e5))
|
|
33
|
+
* fixed conflicts ([e2b84b8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e2b84b885e229e28ca9fc71c36fc728a854d5693))
|
|
34
|
+
* keep open FAQ when js is blocked ([230d1db](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/230d1db97e2fd99646ee63abab10473d204d1adc))
|
|
35
|
+
* return 70 coverage ([b14b876](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b14b876bba8ffbfd90fa27da95b5bdb2650dde3e))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
* Merge branch 'tm-2697-Faq' into 'master' ([4615d58](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4615d5853a2ef640834bbbdfc0ba019ed2987cb6))
|
|
39
|
+
|
|
40
|
+
## [3.2.24](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.23...v3.2.24) (2022-02-07)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* add unit testing ([5555f87](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5555f87f6571b22c237a72b48c37839ec4962192))
|
|
46
|
+
* added image cdn in gatsby config ([793c117](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/793c117876297a926b76f2aa263ecb7288baae0f))
|
|
47
|
+
* fixed demo url ([3f6c562](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3f6c5621f0b6edc2d2b9b14393b874c8376f3cc5))
|
|
48
|
+
* fixed warnings ([1801220](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1801220463d8bc52f3a1babe2fd952b45ebff591))
|
|
49
|
+
* inercase coverage ([8753dd0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8753dd079ad2a75d443a26abf8508449744cc93d))
|
|
50
|
+
* make style for faq ([3c0732c](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3c0732c1306229b80cc2115f58e2eccc9690c470))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
* Merge branch 'tm-2695-image_cdn' into 'master' ([6f91e36](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6f91e3601b97f29d2d9bf26cec22a477b4080348))
|
|
54
|
+
* Merge branch 'tm-2696-unit-testing' into 'master' ([b7c4ef8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b7c4ef882aa7a5db409c0e72069b9d303e51600f))
|
|
55
|
+
* Merge branch 'tm-2696-faq-module-splits' into 'master' ([648da8b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/648da8bb2208aa91bdaa6e8a32b7ee6a29072a2c))
|
|
56
|
+
|
|
1
57
|
## [3.2.23](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.22...v3.2.23) (2022-02-02)
|
|
2
58
|
|
|
3
59
|
|
package/gatsby-config.js
CHANGED
|
@@ -20,8 +20,7 @@ module.exports = {
|
|
|
20
20
|
'https://www.google-analytics.com',
|
|
21
21
|
'https://www.googletagmanager.com',
|
|
22
22
|
'https://gm.innocraft.cloud',
|
|
23
|
-
|
|
24
|
-
'https://d3449cb8ihm3k3.cloudfront.net',
|
|
23
|
+
process.env.IMAGE_CDN_URL,
|
|
25
24
|
],
|
|
26
25
|
},
|
|
27
26
|
},
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-matrix-theme",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.27",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Matrix Theme NPM Package",
|
|
6
6
|
"author": "",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"cross-env": "^7.0.2",
|
|
32
32
|
"dotenv": "8.2.0",
|
|
33
33
|
"gatsby": "^3.3.1",
|
|
34
|
-
"gatsby-core-theme": "^
|
|
34
|
+
"gatsby-core-theme": "^3.0.0",
|
|
35
35
|
"gatsby-image": "^3.3.0",
|
|
36
36
|
"gatsby-plugin-image": "^1.3.1",
|
|
37
37
|
"gatsby-plugin-postcss": "^4.3.0",
|
|
@@ -23,6 +23,13 @@ describe('AuthorCard Component', () => {
|
|
|
23
23
|
expect(container.querySelector('a').innerHTML).toEqual(email_address);
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
+
|
|
27
|
+
test('render empty value', () => {
|
|
28
|
+
const obj = {};
|
|
29
|
+
const { container } = render(<AuthorCard author={obj} />);
|
|
30
|
+
|
|
31
|
+
expect(container.querySelector('img')).toBeFalsy();
|
|
32
|
+
});
|
|
26
33
|
});
|
|
27
34
|
afterEach(() => {
|
|
28
35
|
cleanup();
|
|
@@ -15,35 +15,43 @@ import styles from './table.module.scss';
|
|
|
15
15
|
|
|
16
16
|
const listHeadings = [
|
|
17
17
|
{
|
|
18
|
+
id: 1,
|
|
18
19
|
defaultValue: 'Casino name',
|
|
19
20
|
key: 'casino_name',
|
|
20
21
|
},
|
|
21
22
|
{
|
|
23
|
+
id: 2,
|
|
22
24
|
defaultValue: 'Rating',
|
|
23
25
|
key: 'rating',
|
|
24
26
|
},
|
|
25
27
|
{
|
|
28
|
+
id: 3,
|
|
26
29
|
defaultValue: 'Bonus',
|
|
27
30
|
key: 'bonus',
|
|
28
31
|
// customComponent: ({operator}) => ( <td>{operator.title}</td> ), This is an example
|
|
29
32
|
},
|
|
30
33
|
{
|
|
34
|
+
id: 4,
|
|
31
35
|
defaultValue: 'Top Features',
|
|
32
36
|
key: 'top_features',
|
|
33
37
|
},
|
|
34
38
|
{
|
|
39
|
+
id: 5,
|
|
35
40
|
defaultValue: 'Payment Methods',
|
|
36
41
|
key: 'payment_methods',
|
|
37
42
|
},
|
|
38
43
|
{
|
|
44
|
+
id: 6,
|
|
39
45
|
defaultValue: 'Banking',
|
|
40
46
|
key: 'banking',
|
|
41
47
|
},
|
|
42
48
|
{
|
|
49
|
+
id: 7,
|
|
43
50
|
defaultValue: 'Currencies',
|
|
44
51
|
key: 'currencies',
|
|
45
52
|
},
|
|
46
53
|
{
|
|
54
|
+
id: 8,
|
|
47
55
|
defaultValue: 'Licenses',
|
|
48
56
|
key: 'licenses',
|
|
49
57
|
},
|
|
@@ -60,7 +68,7 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
60
68
|
const rowData = tabelInfo.find((m) => m.key === heading);
|
|
61
69
|
if (rowData && rowData.customComponent) {
|
|
62
70
|
const CustomComponent = rowData.customComponent;
|
|
63
|
-
return <CustomComponent operator={item} />;
|
|
71
|
+
return <CustomComponent key={key} operator={item} />;
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
switch (heading) {
|
|
@@ -104,7 +112,8 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
104
112
|
{item?.relation?.selling_points &&
|
|
105
113
|
item?.relation?.selling_points.map((sellingPoint) => (
|
|
106
114
|
<span key={sellingPoint}>
|
|
107
|
-
<AiOutlineCheckCircle size={27} />
|
|
115
|
+
<AiOutlineCheckCircle size={27} />
|
|
116
|
+
{sellingPoint}
|
|
108
117
|
</span>
|
|
109
118
|
))}
|
|
110
119
|
</td>
|
|
@@ -119,7 +128,7 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
119
128
|
const itemsLength = list.length === 6 ? 6 : 5;
|
|
120
129
|
if (i < (showAllPayment.includes(index) ? list.length : itemsLength)) {
|
|
121
130
|
return (
|
|
122
|
-
<span key={deposit.name}>
|
|
131
|
+
<span key={`${key}-${deposit.name}`}>
|
|
123
132
|
<LazyImg
|
|
124
133
|
src={imagePrettyUrl(deposit?.logo_filename)}
|
|
125
134
|
width={72}
|
|
@@ -166,7 +175,7 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
166
175
|
{item?.relation?.bonus?.currencies &&
|
|
167
176
|
item?.relation?.bonus?.currencies.slice(0, 6).map((currencies) => (
|
|
168
177
|
// eslint-disable-next-line react/no-array-index-key
|
|
169
|
-
<span key={currencies.iso_code}>{currencies.iso_code}
|
|
178
|
+
<span key={`${key}-${currencies.iso_code}`}>{currencies.iso_code}</span>
|
|
170
179
|
))}
|
|
171
180
|
</td>
|
|
172
181
|
);
|
|
@@ -178,6 +187,7 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
178
187
|
.slice(0, 3)
|
|
179
188
|
.map((license) => (
|
|
180
189
|
<LazyImg
|
|
190
|
+
key={license.name}
|
|
181
191
|
src={imagePrettyUrl(license?.logo_filename)}
|
|
182
192
|
height={32}
|
|
183
193
|
alt={license.name}
|
|
@@ -186,7 +196,7 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
186
196
|
</td>
|
|
187
197
|
);
|
|
188
198
|
default:
|
|
189
|
-
return
|
|
199
|
+
return null;
|
|
190
200
|
}
|
|
191
201
|
};
|
|
192
202
|
|
|
@@ -196,11 +206,11 @@ export default function ComparisonTable({ items, tabelInfo = listHeadings, ctaKe
|
|
|
196
206
|
const cells = [];
|
|
197
207
|
|
|
198
208
|
items.forEach((item, index) => {
|
|
199
|
-
cells.push(cell(heading.key, item, `${heading}-${index}`, index));
|
|
209
|
+
cells.push(cell(heading.key, item, `${heading.key}-${index}`, index));
|
|
200
210
|
});
|
|
201
211
|
|
|
202
212
|
row.push(
|
|
203
|
-
<tr>
|
|
213
|
+
<tr key={heading.key}>
|
|
204
214
|
<th>{translate(translations, heading.key, heading.defaultValue)}</th>
|
|
205
215
|
{cells}
|
|
206
216
|
</tr>
|
|
@@ -1,21 +1,73 @@
|
|
|
1
|
+
/* eslint-disable no-unused-expressions */
|
|
1
2
|
/* eslint-disable array-callback-return */
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import { render, cleanup } from '@testing-library/react';
|
|
4
|
+
import { render, cleanup, fireEvent } from '@testing-library/react';
|
|
4
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
-
import {
|
|
6
|
+
import { sampleOperatorCards } from '../../../../../../tests/factories/modules/matrix/card.factory';
|
|
6
7
|
|
|
7
8
|
import ComparisonTable from '.';
|
|
8
9
|
|
|
9
|
-
const module =
|
|
10
|
+
const module = sampleOperatorCards;
|
|
10
11
|
|
|
11
12
|
describe('Comparison table test component', () => {
|
|
12
13
|
test('render', () => {
|
|
13
|
-
const { getByText } = render(<ComparisonTable items={module.items} />);
|
|
14
|
-
|
|
14
|
+
const { getByText, container } = render(<ComparisonTable items={module.items} />);
|
|
15
15
|
module.items.map((item) => {
|
|
16
|
+
expect(container.querySelectorAll('table')).toHaveLength(1);
|
|
16
17
|
expect(getByText(item.relation.name));
|
|
18
|
+
|
|
19
|
+
const paymentMethods = container.querySelector('.paymentMethods');
|
|
20
|
+
const loadMoreBtn = paymentMethods.querySelector('a');
|
|
21
|
+
// eslint-disable-next-line no-unused-expressions
|
|
22
|
+
loadMoreBtn && expect(paymentMethods.querySelectorAll('span').length).toEqual(5);
|
|
23
|
+
loadMoreBtn && fireEvent.click(loadMoreBtn);
|
|
24
|
+
loadMoreBtn && expect(paymentMethods.querySelectorAll('span').length).toBeGreaterThan(5);
|
|
17
25
|
});
|
|
18
26
|
});
|
|
27
|
+
|
|
28
|
+
test('render with custom component', () => {
|
|
29
|
+
const filterItems = [{ ...module.items[0] }];
|
|
30
|
+
|
|
31
|
+
const { getByText } = render(
|
|
32
|
+
<ComparisonTable
|
|
33
|
+
items={filterItems}
|
|
34
|
+
tabelInfo={[
|
|
35
|
+
{
|
|
36
|
+
defaultValue: 'Rating',
|
|
37
|
+
key: 'rating',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
defaultValue: 'Bonus',
|
|
41
|
+
key: 'bonus',
|
|
42
|
+
customComponent: () => <td>coupon code</td>,
|
|
43
|
+
},
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
expect(getByText('coupon code')).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('render false value', () => {
|
|
52
|
+
const filterItems = [{ ...module.items[1] }];
|
|
53
|
+
const { container } = render(
|
|
54
|
+
<ComparisonTable
|
|
55
|
+
items={filterItems}
|
|
56
|
+
tabelInfo={[
|
|
57
|
+
{
|
|
58
|
+
defaultValue: 'default',
|
|
59
|
+
key: 'default',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
defaultValue: 'Payment Methods',
|
|
63
|
+
key: 'payment_methods',
|
|
64
|
+
},
|
|
65
|
+
]}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
const paymentMethods = container.querySelector('.paymentMethods');
|
|
69
|
+
expect(paymentMethods.querySelectorAll('span').length).toEqual(6);
|
|
70
|
+
});
|
|
19
71
|
});
|
|
20
72
|
afterEach(() => {
|
|
21
73
|
cleanup();
|
|
@@ -25,15 +25,17 @@ const GameCard = ({ item, button_text = 'play_now', width, height }) => {
|
|
|
25
25
|
return (
|
|
26
26
|
<BaseCard item={item} isLinked cardType="game">
|
|
27
27
|
{!featured && (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
)}
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
<Link
|
|
29
|
+
to={path}
|
|
30
|
+
className={`game-card-gtm ${styles.cardBanner}`}
|
|
31
|
+
aria-label={`${title} Link`}
|
|
32
|
+
>
|
|
33
|
+
{banner ? (
|
|
34
|
+
<LazyImage width={width} height={height} src={imagePrettyUrl(banner)} alt={title} />
|
|
35
|
+
) : (
|
|
36
|
+
<GatsbyImg filename="default-slot.jpg" alt={title} />
|
|
37
|
+
)}
|
|
38
|
+
</Link>
|
|
37
39
|
)}
|
|
38
40
|
<div className={`${styles.cardContent} ${featured && styles.featured}`}>
|
|
39
41
|
<Link to={path} className="game-card-gtm">
|
|
@@ -25,6 +25,14 @@ describe('SocialIcons Component', () => {
|
|
|
25
25
|
expect(socialLinksWrapper.querySelectorAll('a')[2].innerText).toEqual(siteSchema[2]);
|
|
26
26
|
expect(socialLinksWrapper.querySelectorAll('a')[4].innerText).toEqual(siteSchema[4]);
|
|
27
27
|
});
|
|
28
|
+
|
|
29
|
+
test('render null value', () => {
|
|
30
|
+
const obj = {
|
|
31
|
+
default: 'default',
|
|
32
|
+
};
|
|
33
|
+
const { container } = render(<SocialIcons socialIcons={obj} />);
|
|
34
|
+
expect(container.querySelector('svg')).toBe(null);
|
|
35
|
+
});
|
|
28
36
|
});
|
|
29
37
|
afterEach(() => {
|
|
30
38
|
cleanup();
|
|
@@ -22,6 +22,12 @@ describe('summary component', () => {
|
|
|
22
22
|
// expect(container.querySelector('img')).toBeFalsy();
|
|
23
23
|
// expect(container.querySelectorAll('div.lazyload-placeholder')).toHaveLength(1);
|
|
24
24
|
});
|
|
25
|
+
|
|
26
|
+
test('render empty', () => {
|
|
27
|
+
const { container } = render(<Slide />);
|
|
28
|
+
|
|
29
|
+
expect(container.querySelector('p')).toBeFalsy();
|
|
30
|
+
});
|
|
25
31
|
});
|
|
26
32
|
afterEach(() => {
|
|
27
33
|
cleanup();
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
font-weight: 700;
|
|
20
20
|
padding: 1rem 0;
|
|
21
21
|
outline: none;
|
|
22
|
+
padding-right: 2.5rem;
|
|
22
23
|
.icon{
|
|
23
24
|
display: flex;
|
|
24
25
|
align-items: center;
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
|
|
62
63
|
.content {
|
|
63
64
|
@include collapse(0.5s, 500rem);
|
|
65
|
+
@include flex-direction(column);
|
|
64
66
|
font-size: 1.6rem;
|
|
65
67
|
color: var(--color-20);
|
|
66
68
|
padding: 0;
|
|
@@ -7,15 +7,15 @@ import keygen from '~helpers/keygen';
|
|
|
7
7
|
|
|
8
8
|
/* eslint-disable react/no-danger */
|
|
9
9
|
|
|
10
|
-
const Faq = ({ module,
|
|
10
|
+
const Faq = ({ module, closeAll = false, openItem, closeOthers = false, icon = '' }) => {
|
|
11
11
|
const { items } = module;
|
|
12
12
|
const itemRefs = useRef([]);
|
|
13
13
|
const btnRefs = useRef([]);
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const closeAllItems = () => {
|
|
16
16
|
for (let i = 0; i < itemRefs.current.length; i += 1) {
|
|
17
|
-
itemRefs.current[i].classList.
|
|
18
|
-
btnRefs.current[i].classList.
|
|
17
|
+
itemRefs.current[i].classList.remove(styles.active);
|
|
18
|
+
btnRefs.current[i].classList.remove(styles.invertArrow);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -45,8 +45,8 @@ const Faq = ({ module, openAll = true, openItem, closeOthers = false, icon = ''
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
useEffect(() => {
|
|
48
|
-
if (
|
|
49
|
-
|
|
48
|
+
if (closeAll) {
|
|
49
|
+
closeAllItems();
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
useEffect(() => {
|
|
@@ -72,7 +72,7 @@ const Faq = ({ module, openAll = true, openItem, closeOthers = false, icon = ''
|
|
|
72
72
|
</span>
|
|
73
73
|
</button>
|
|
74
74
|
<div
|
|
75
|
-
className={styles.content}
|
|
75
|
+
className={`${styles.content} ${styles.active}`}
|
|
76
76
|
ref={(el) => (itemRefs.current[index] = el)}
|
|
77
77
|
dangerouslySetInnerHTML={{ __html: item.answer }}
|
|
78
78
|
/>
|
|
@@ -93,7 +93,7 @@ Faq.propTypes = {
|
|
|
93
93
|
})
|
|
94
94
|
),
|
|
95
95
|
}).isRequired,
|
|
96
|
-
|
|
96
|
+
closeAll: PropTypes.bool,
|
|
97
97
|
openItem: PropTypes.number,
|
|
98
98
|
closeOthers: PropTypes.bool,
|
|
99
99
|
styles: PropTypes.shape({}),
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
+
// import{ getHeaderSection} from 'gatsby-core-theme/tests/factories/sections/header.factory';
|
|
5
|
+
import '~tests/helpers/match-media.mock';
|
|
6
|
+
import Header, { headerContent } from './index';
|
|
7
|
+
|
|
8
|
+
function getHeaderSection() {
|
|
9
|
+
const header = {
|
|
10
|
+
section: {
|
|
11
|
+
page: {
|
|
12
|
+
template: 'author',
|
|
13
|
+
title: 'The Page Title',
|
|
14
|
+
path: 'sport/brand',
|
|
15
|
+
sections: {
|
|
16
|
+
header: {
|
|
17
|
+
extra_fields: {
|
|
18
|
+
header_background_image: '398f163bfd5a201716fb42aa72ae48b0.jpeg',
|
|
19
|
+
header_tesxt: '<p><i>Hello</i> I am test text</p>',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return header;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe('header component', () => {
|
|
31
|
+
test('headerContent', () => {
|
|
32
|
+
const getHeaderPropsTest = (cases) => {
|
|
33
|
+
const props = {
|
|
34
|
+
section: {
|
|
35
|
+
page: {
|
|
36
|
+
template: cases,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return props;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const list = [
|
|
45
|
+
'article_detail',
|
|
46
|
+
'article_casino',
|
|
47
|
+
'article_sports',
|
|
48
|
+
'operator_review',
|
|
49
|
+
'game_review',
|
|
50
|
+
'author',
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const all = list.reduce((acc, current) => {
|
|
54
|
+
acc.push(getHeaderPropsTest(current));
|
|
55
|
+
return acc;
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
all.forEach((elm) => {
|
|
59
|
+
expect(headerContent(elm)).toBeTruthy();
|
|
60
|
+
});
|
|
61
|
+
expect(headerContent('test')).toBeFalsy();
|
|
62
|
+
|
|
63
|
+
// expect(headerContent(props)).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('render', () => {
|
|
67
|
+
const HeaderProps = getHeaderSection();
|
|
68
|
+
const enabledBgImg = ['author', 'game_review', 'operator_review'];
|
|
69
|
+
|
|
70
|
+
const { container } = render(
|
|
71
|
+
<Header
|
|
72
|
+
{...HeaderProps}
|
|
73
|
+
backgroundImage={enabledBgImg.includes(HeaderProps?.section?.page?.template)}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
// const
|
|
77
|
+
expect(container.querySelector('header')).toBeTruthy();
|
|
78
|
+
expect(container.querySelectorAll('header')).toHaveLength(1);
|
|
79
|
+
expect(container.querySelectorAll('div')).toHaveLength(3);
|
|
80
|
+
|
|
81
|
+
// Inner HTML
|
|
82
|
+
expect(container.querySelectorAll('p')).toHaveLength(0);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
afterEach(() => {
|
|
86
|
+
cleanup();
|
|
87
|
+
});
|
|
@@ -5,43 +5,43 @@ import Header from 'gatsby-core-theme/src/components/molecules/header/index';
|
|
|
5
5
|
import loadable from '@loadable/component';
|
|
6
6
|
|
|
7
7
|
/* eslint-disable react/prop-types */
|
|
8
|
+
export const headerContent = (props) => {
|
|
9
|
+
let ModuleComponent = null;
|
|
10
|
+
// const t2st = 'just test'
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
case 'game_review': {
|
|
25
|
-
ModuleComponent = loadable(() => import('./variants/slot'));
|
|
26
|
-
return <ModuleComponent page={props.section.page} />;
|
|
27
|
-
}
|
|
28
|
-
case 'author': {
|
|
29
|
-
ModuleComponent = loadable(() => import('./variants/author'));
|
|
30
|
-
return <ModuleComponent page={props.section.page} />;
|
|
31
|
-
}
|
|
32
|
-
default:
|
|
33
|
-
return ModuleComponent;
|
|
12
|
+
switch (props?.section?.page?.template) {
|
|
13
|
+
case 'article_detail':
|
|
14
|
+
case 'article_casino':
|
|
15
|
+
case 'article_sports': {
|
|
16
|
+
ModuleComponent = loadable(() => import('./variants/article'));
|
|
17
|
+
return <ModuleComponent page={props.section.page} />;
|
|
18
|
+
}
|
|
19
|
+
case 'operator_review': {
|
|
20
|
+
ModuleComponent = loadable(() => import('./variants/operator'));
|
|
21
|
+
return <ModuleComponent operator={props.section.page.relation} />;
|
|
22
|
+
}
|
|
23
|
+
case 'game_review': {
|
|
24
|
+
ModuleComponent = loadable(() => import('./variants/slot'));
|
|
25
|
+
return <ModuleComponent page={props.section.page} />;
|
|
34
26
|
}
|
|
35
|
-
|
|
27
|
+
case 'author': {
|
|
28
|
+
ModuleComponent = loadable(() => import('./variants/author'));
|
|
29
|
+
return <ModuleComponent page={props.section.page} />;
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
return ModuleComponent;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
36
35
|
|
|
36
|
+
export default (props) => {
|
|
37
37
|
const enabledBgImg = ['author', 'game_review', 'operator_review'];
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<Header
|
|
41
41
|
{...props}
|
|
42
|
-
content={headerContent()}
|
|
42
|
+
content={headerContent(props)}
|
|
43
43
|
// eslint-disable-next-line no-unneeded-ternary
|
|
44
|
-
backgroundImage={enabledBgImg.includes(props
|
|
44
|
+
backgroundImage={enabledBgImg.includes(props?.section?.page?.template) ? false : true}
|
|
45
45
|
/>
|
|
46
46
|
);
|
|
47
47
|
};
|
|
@@ -5,6 +5,20 @@ import '@testing-library/jest-dom/extend-expect';
|
|
|
5
5
|
import getPageData from 'gatsby-core-theme/tests/factories/pages/default.factory';
|
|
6
6
|
import OperatorSummary from '.';
|
|
7
7
|
|
|
8
|
+
const pageTest = {
|
|
9
|
+
title: 'The Page Title',
|
|
10
|
+
// type: 'test',
|
|
11
|
+
name: 'Rizk Casino',
|
|
12
|
+
extra_fields: {
|
|
13
|
+
related_operator: {
|
|
14
|
+
extra_fields: {
|
|
15
|
+
terms_and_conditions_text_enabled: '1',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
summary_background: 'summary_background',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
8
22
|
describe('summary component', () => {
|
|
9
23
|
test('render', () => {
|
|
10
24
|
const { container, getByText } = render(<OperatorSummary page={getPageData()} />);
|
|
@@ -23,6 +37,16 @@ describe('summary component', () => {
|
|
|
23
37
|
// CTA
|
|
24
38
|
expect(getByText('Visit')).toBeTruthy();
|
|
25
39
|
});
|
|
40
|
+
|
|
41
|
+
test('', () => {
|
|
42
|
+
const { container, getByText } = render(
|
|
43
|
+
<OperatorSummary page={pageTest} tracker="main" activeOperator />
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect(container.querySelectorAll('a')).toHaveLength(2);
|
|
47
|
+
expect(getByText('18+ New Players only. Play responsibly.')).toBeTruthy();
|
|
48
|
+
expect(container.querySelectorAll('div')).toHaveLength(3);
|
|
49
|
+
});
|
|
26
50
|
});
|
|
27
51
|
afterEach(() => {
|
|
28
52
|
cleanup();
|
|
@@ -55,7 +55,11 @@ export default function Row({
|
|
|
55
55
|
<Link to={reviewPath} className="toplist-variant-one-gtm">
|
|
56
56
|
<Label
|
|
57
57
|
title={getExtraField(item.extra_fields, 'ribbon_text')}
|
|
58
|
-
bgColor={
|
|
58
|
+
bgColor={
|
|
59
|
+
getExtraField(item.extra_fields, 'ribbon_color')
|
|
60
|
+
? getExtraField(item.extra_fields, 'ribbon_color')
|
|
61
|
+
: '#0000'
|
|
62
|
+
}
|
|
59
63
|
/>
|
|
60
64
|
</Link>
|
|
61
65
|
)}
|
|
@@ -64,6 +64,22 @@ describe('toplist row component', () => {
|
|
|
64
64
|
// CTA
|
|
65
65
|
expect(getByText('Visit').closest('a').getAttribute('href')).toEqual('/shortName1');
|
|
66
66
|
});
|
|
67
|
+
|
|
68
|
+
test('render pros', () => {
|
|
69
|
+
const list = getToplistItem();
|
|
70
|
+
const updateObj = {
|
|
71
|
+
...list,
|
|
72
|
+
extra_fields: {
|
|
73
|
+
pro_1: 'pro1',
|
|
74
|
+
ribbon_text: 'ribbon_text',
|
|
75
|
+
terms_and_conditions_text_enabled: '1',
|
|
76
|
+
},
|
|
77
|
+
review_link: null,
|
|
78
|
+
};
|
|
79
|
+
const { getByText } = render(<Row item={updateObj} />);
|
|
80
|
+
expect(getByText('ribbon_text')).toBeTruthy();
|
|
81
|
+
expect(getByText('pro1')).toBeTruthy();
|
|
82
|
+
});
|
|
67
83
|
});
|
|
68
84
|
afterEach(() => {
|
|
69
85
|
cleanup();
|