gatsby-matrix-theme 3.2.20 → 3.2.24

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/jest.config.js +1 -1
  3. package/package.json +2 -2
  4. package/src/components/atoms/author-card/author-card.test.js +7 -0
  5. package/src/components/atoms/cards/comparison-table/table/index.js +17 -7
  6. package/src/components/atoms/cards/comparison-table/table/table.test.js +57 -5
  7. package/src/components/atoms/cards/popup-card/index.js +2 -2
  8. package/src/components/atoms/social-icons/social-icons.test.js +8 -0
  9. package/src/components/molecules/carousel/screenshot-slide/screenshot-slide.test.js +6 -0
  10. package/src/components/molecules/faq/faq.module.scss +2 -0
  11. package/src/components/molecules/header/header.test.js +87 -0
  12. package/src/components/molecules/header/index.js +28 -28
  13. package/src/components/molecules/operator-summary/operator-summary.test.js +24 -0
  14. package/src/components/molecules/toplist/row/variant-one.js +5 -1
  15. package/src/components/molecules/toplist/row/variant-one.test.js +16 -0
  16. package/src/components/organisms/footer-navigation/index.js +28 -3
  17. package/src/components/organisms/popup/popup.test.js +2 -1
  18. package/src/components/pages/contact-us/index.js +1 -0
  19. package/src/gatsby-core-theme/components/atoms/menu/items/item/item.module.scss +55 -0
  20. package/src/gatsby-core-theme/components/molecules/content/index.js +2 -1
  21. package/src/gatsby-core-theme/components/organisms/carousel/index.js +11 -20
  22. package/storybook/public/{0.7e85895a.iframe.bundle.js → 0.e515c4bf.iframe.bundle.js} +1 -1
  23. package/storybook/public/{1.5b14cfe6.iframe.bundle.js → 1.ac251b98.iframe.bundle.js} +1 -1
  24. package/storybook/public/{10.3d48be86.iframe.bundle.js → 10.ff8f20a0.iframe.bundle.js} +1 -1
  25. package/storybook/public/{11.3e5dcd6e.iframe.bundle.js → 11.a965ed36.iframe.bundle.js} +1 -1
  26. package/storybook/public/{12.be3dbae0.iframe.bundle.js → 12.f31f86bb.iframe.bundle.js} +1 -1
  27. package/storybook/public/{13.4c418d5e.iframe.bundle.js → 13.c72a573a.iframe.bundle.js} +1 -1
  28. package/storybook/public/{14.13d10e61.iframe.bundle.js → 14.454a253c.iframe.bundle.js} +1 -1
  29. package/storybook/public/{15.2a8de093.iframe.bundle.js → 15.baadf857.iframe.bundle.js} +1 -1
  30. package/storybook/public/{16.e735ba7a.iframe.bundle.js → 16.9d6c22db.iframe.bundle.js} +1 -1
  31. package/storybook/public/{5.8dc0a3f7.iframe.bundle.js → 5.7148fbb6.iframe.bundle.js} +3 -3
  32. package/storybook/public/{5.8dc0a3f7.iframe.bundle.js.LICENSE.txt → 5.7148fbb6.iframe.bundle.js.LICENSE.txt} +0 -0
  33. package/storybook/public/5.7148fbb6.iframe.bundle.js.map +1 -0
  34. package/storybook/public/{6.7df44593.iframe.bundle.js → 6.ad9d9402.iframe.bundle.js} +1 -1
  35. package/storybook/public/{7.3d56e7df.iframe.bundle.js → 7.061faab7.iframe.bundle.js} +1 -1
  36. package/storybook/public/{8.447f6c90.iframe.bundle.js → 8.fd6b3f00.iframe.bundle.js} +1 -1
  37. package/storybook/public/{9.ad2cc66b.iframe.bundle.js → 9.f220a5b6.iframe.bundle.js} +3 -3
  38. package/storybook/public/{9.ad2cc66b.iframe.bundle.js.LICENSE.txt → 9.f220a5b6.iframe.bundle.js.LICENSE.txt} +0 -0
  39. package/storybook/public/9.f220a5b6.iframe.bundle.js.map +1 -0
  40. package/storybook/public/iframe.html +1 -1
  41. package/storybook/public/main.17fb3064.iframe.bundle.js +1 -0
  42. package/storybook/public/{runtime~main.ff9a4d14.iframe.bundle.js → runtime~main.d4a6ad7e.iframe.bundle.js} +1 -1
  43. package/storybook/public/{vendors~main.5d3ed7a5.iframe.bundle.js → vendors~main.73d094d3.iframe.bundle.js} +4 -4
  44. package/storybook/public/{vendors~main.5d3ed7a5.iframe.bundle.js.LICENSE.txt → vendors~main.73d094d3.iframe.bundle.js.LICENSE.txt} +0 -0
  45. package/storybook/public/vendors~main.73d094d3.iframe.bundle.js.map +1 -0
  46. package/tests/factories/modules/matrix/card.factory.js +310 -78
  47. package/storybook/public/5.8dc0a3f7.iframe.bundle.js.map +0 -1
  48. package/storybook/public/9.ad2cc66b.iframe.bundle.js.map +0 -1
  49. package/storybook/public/main.57e38d6c.iframe.bundle.js +0 -1
  50. package/storybook/public/vendors~main.5d3ed7a5.iframe.bundle.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,71 @@
1
+ ## [3.2.24](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.23...v3.2.24) (2022-02-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add unit testing ([5555f87](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5555f87f6571b22c237a72b48c37839ec4962192))
7
+ * added image cdn in gatsby config ([793c117](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/793c117876297a926b76f2aa263ecb7288baae0f))
8
+ * fixed demo url ([3f6c562](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3f6c5621f0b6edc2d2b9b14393b874c8376f3cc5))
9
+ * fixed warnings ([1801220](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1801220463d8bc52f3a1babe2fd952b45ebff591))
10
+ * inercase coverage ([8753dd0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/8753dd079ad2a75d443a26abf8508449744cc93d))
11
+ * make style for faq ([3c0732c](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/3c0732c1306229b80cc2115f58e2eccc9690c470))
12
+
13
+
14
+ * Merge branch 'tm-2695-image_cdn' into 'master' ([6f91e36](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6f91e3601b97f29d2d9bf26cec22a477b4080348))
15
+ * Merge branch 'tm-2696-unit-testing' into 'master' ([b7c4ef8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b7c4ef882aa7a5db409c0e72069b9d303e51600f))
16
+ * Merge branch 'tm-2696-faq-module-splits' into 'master' ([648da8b](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/648da8bb2208aa91bdaa6e8a32b7ee6a29072a2c))
17
+
18
+ ## [3.2.23](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.22...v3.2.23) (2022-02-02)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * add scroll on footer nav ([da45e5d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/da45e5de716e6e6afd7f362c9f036309f6b8168f))
24
+ * add show after 3 seconds functionality on footer nav ([9e49a61](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9e49a61e531399b34d6e6b7f0ae5a0f945f3861e))
25
+ * fix carousel not showing when js is off ([f976424](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f976424bbcf1a2cad3a8a7d20e407dfd15b6c848))
26
+
27
+
28
+ * Merge branch 'tm-2684-footerNav-optimization' into 'master' ([fdeec64](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fdeec64fc8a922628107b33134577187b95d150e))
29
+ * Merge branch 'tm-2691-images-carousel' into 'master' ([90d05e0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/90d05e0d84b8d5f78f12691d7e03a9833e317eb3))
30
+
31
+
32
+ ### norelease
33
+
34
+ * change env sitename ([fa10ded](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/fa10ded0f9d09b909eff2443d27281234ed39bce))
35
+ * revert back env ([9897255](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9897255ed23e4b714c99474d47000a91d00b223b))
36
+
37
+ ## [3.2.22](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.21...v3.2.22) (2022-02-02)
38
+
39
+
40
+ ### Config
41
+
42
+ * updated core version ([1bb6e2d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/1bb6e2d325e2a01c6aae75da5dcc671caf0fdde7))
43
+
44
+ ## [3.2.21](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.20...v3.2.21) (2022-02-02)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+ * content module imag cdn links ([74397ae](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/74397ae8014326641382559ea1dbe3a329f0b54d))
50
+ * navigation menu fix ([9c4ad08](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9c4ad0819e79a4dea4dc44876992278dd4ea5a12))
51
+ * popup images set to lazy load ([86c6c4a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/86c6c4ac7089d10b23d92e21ee49d442fcc2a7f3))
52
+ * string helper import ([6af965d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6af965d1cad7d70f027b85ab7f0de1b927edef94))
53
+
54
+
55
+ ### Config
56
+
57
+ * updated core theme ([a124f7e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a124f7eb702aff3607123d3952c5cf449285d218))
58
+
59
+
60
+ * Merge branch 'tm-2684-popup-images' into 'master' ([d5fa878](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d5fa878baac4f37322a12dae8650afb6e284377d))
61
+ * Merge branch 'navigation' into 'master' ([2cf85d8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/2cf85d8b533311ed6a14b93e6ecb8f30414e5153))
62
+ * Merge branch 'tm-2685-content-module-image-cdn' into 'master' ([b79fa10](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/b79fa101af2109bc0639f7db7462a006bbecf1d6))
63
+
64
+
65
+ ### Tests
66
+
67
+ * fixed popup test ([0b4060e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/0b4060e4f2f3cf1a68209550e53c804f1d959dff))
68
+
1
69
  ## [3.2.20](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v3.2.19...v3.2.20) (2022-01-28)
2
70
 
3
71
 
package/jest.config.js CHANGED
@@ -31,7 +31,7 @@ module.exports = {
31
31
  collectCoverage: true,
32
32
  coverageThreshold: {
33
33
  global: {
34
- statements: 70,
34
+ statements: 88,
35
35
  },
36
36
  },
37
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-matrix-theme",
3
- "version": "3.2.20",
3
+ "version": "3.2.24",
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": "^2.2.4",
34
+ "gatsby-core-theme": "^2.2.6",
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} /> {sellingPoint}
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} </span>
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 { getSampleOperatorCards } from 'gatsby-core-theme/tests/factories/modules/card.factory';
6
+ import { sampleOperatorCards } from '../../../../../../tests/factories/modules/matrix/card.factory';
6
7
 
7
8
  import ComparisonTable from '.';
8
9
 
9
- const module = getSampleOperatorCards();
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();
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
-
4
3
  import OperatorCta from 'gatsby-core-theme/src/components/atoms/operator-cta';
5
4
  import { imagePrettyUrl } from 'gatsby-core-theme/src/helpers/getters';
5
+ import LazyImage from '~hooks/lazy-image';
6
6
 
7
7
  import styles from './popup-card.module.scss';
8
8
 
@@ -19,7 +19,7 @@ const PopupCard = ({ item, tracker }) => {
19
19
  <div className={styles.popupCard}>
20
20
  <div className={styles.wrapper}>
21
21
  <div className={styles.imgContainer}>
22
- <img width={98} height={98} src={imagePrettyUrl(logoUrl)} alt={oneLiner} />
22
+ <LazyImage src={imagePrettyUrl(logoUrl)} alt={oneLiner} width={98} height={98} />
23
23
  </div>
24
24
  <div className={styles.textContainer}>
25
25
  <p className={styles.primaryText}>{one}</p>
@@ -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;
@@ -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
- export default (props) => {
10
- const headerContent = () => {
11
- let ModuleComponent = null;
12
-
13
- switch (props.section.page.template) {
14
- case 'article_detail':
15
- case 'article_casino':
16
- case 'article_sports': {
17
- ModuleComponent = loadable(() => import('./variants/article'));
18
- return <ModuleComponent page={props.section.page} />;
19
- }
20
- case 'operator_review': {
21
- ModuleComponent = loadable(() => import('./variants/operator'));
22
- return <ModuleComponent operator={props.section.page.relation} />;
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.section.page.template) ? false : true}
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={getExtraField(item.extra_fields, 'ribbon_color')}
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();
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  import LinkList from 'gatsby-core-theme/src/components/molecules/link-list';
@@ -6,8 +6,33 @@ import { getFirstModuleByName } from 'gatsby-core-theme/src/helpers/getters';
6
6
  import styles from './footer-navigation.module.scss';
7
7
 
8
8
  const FooterNavigation = ({ section, isStorybook = false }) => {
9
+ const [show, setShow] = useState(false);
9
10
  const menuArray = getFirstModuleByName(section, 'menu');
10
- return (
11
+
12
+ const handleEvent = () => {
13
+ setShow(true);
14
+ };
15
+
16
+ const showAfter = (seconds) => {
17
+ setTimeout(() => {
18
+ setShow(true);
19
+ }, seconds * 1000);
20
+ };
21
+
22
+ useEffect(() => {
23
+ window.addEventListener('scroll', handleEvent);
24
+ window.addEventListener('mousemove', handleEvent);
25
+ window.addEventListener('touchstart', handleEvent);
26
+ showAfter(3);
27
+
28
+ return () => {
29
+ window.removeEventListener('scroll', handleEvent);
30
+ window.addEventListener('mousemove', handleEvent);
31
+ window.addEventListener('touchstart', handleEvent);
32
+ };
33
+ }, []);
34
+
35
+ return show ? (
11
36
  <div className={`${styles.footerLinks} ${isStorybook && styles.storybookStyles}`}>
12
37
  <LinkList
13
38
  showListTitle={false}
@@ -19,7 +44,7 @@ const FooterNavigation = ({ section, isStorybook = false }) => {
19
44
  gtmClass="mobile-menu-gtm"
20
45
  />
21
46
  </div>
22
- );
47
+ ) : null;
23
48
  };
24
49
 
25
50
  FooterNavigation.propTypes = {
@@ -18,7 +18,8 @@ describe('Popup test component', () => {
18
18
  const { container } = render(<Popup module={module} isStorybook />);
19
19
  const rows = container.querySelectorAll('.popupCard');
20
20
  expect(rows).toHaveLength(4);
21
- expect(container.querySelectorAll('img')).toHaveLength(4);
21
+
22
+ expect(container.querySelectorAll('.imgContainer')).toHaveLength(4);
22
23
 
23
24
  let isVisible = container.querySelector('.activeModal');
24
25
  expect(isVisible).toBeTruthy();