gatsby-core-theme 33.0.2 → 33.1.1

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 (80) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/gatsby-node.mjs +26 -8
  3. package/jest.config.js +6 -4
  4. package/package.json +1 -1
  5. package/src/components/app-ssr.js +3 -2
  6. package/src/components/atoms/author-box/author-box.test.js +69 -0
  7. package/src/components/atoms/author-box/template-one/author-box.test.js +4 -2
  8. package/src/components/atoms/author-box/template-three/expertion/index.js +2 -2
  9. package/src/components/atoms/button/button.js +8 -0
  10. package/src/components/atoms/button/operator-cta.js +0 -3
  11. package/src/components/atoms/custom-select/custom-select.module.scss +3 -2
  12. package/src/components/atoms/disclaimer/disclaimer.test.js +5 -1
  13. package/src/components/atoms/menu/items/items.test.js +27 -0
  14. package/src/components/atoms/not-found/not-found.test.js +15 -0
  15. package/src/components/atoms/search/autocomplete/operator.js +2 -2
  16. package/src/components/atoms/sitemap/sitemap.test.js +63 -0
  17. package/src/components/molecules/bonus/template-one/bonus.test.js +3 -3
  18. package/src/components/molecules/bonus/template-one/index.js +5 -9
  19. package/src/components/molecules/bonus/template-two/bonus.test.js +0 -2
  20. package/src/components/molecules/bonus/template-two/index.js +3 -6
  21. package/src/components/molecules/content/index.js +7 -4
  22. package/src/components/molecules/content/lists/lists.module.scss +14 -2
  23. package/src/components/molecules/floating-area/index.js +1 -1
  24. package/src/components/molecules/footer/footer.test.js +12 -0
  25. package/src/components/molecules/main/index.js +4 -7
  26. package/src/components/molecules/module/index.js +9 -3
  27. package/src/components/molecules/newsletter/newsletter.test.js +27 -0
  28. package/src/components/molecules/search/index.js +118 -403
  29. package/src/components/molecules/search/search.module.scss +20 -31
  30. package/src/components/molecules/search/search.test.js +132 -0
  31. package/src/components/molecules/spotlights_v2/icon/template-one/index.js +2 -2
  32. package/src/components/molecules/spotlights_v2/image/template-one/index.js +2 -2
  33. package/src/components/molecules/spotlights_v2/image/template-two/index.js +7 -3
  34. package/src/components/molecules/spotlights_v2/image-text/template-one/index.js +4 -1
  35. package/src/components/molecules/spotlights_v2/image-text/template-three/item/index.js +7 -1
  36. package/src/components/molecules/spotlights_v2/image-text/template-two/index.js +4 -1
  37. package/src/components/molecules/toplist/default-row/index.js +5 -13
  38. package/src/components/organisms/accordion/variants/template-one/index.js +2 -0
  39. package/src/components/organisms/anchor/template-one/anchor.test.js +26 -0
  40. package/src/components/organisms/anchor/template-one/index.js +2 -0
  41. package/src/components/organisms/carousel/template-one/index.js +6 -1
  42. package/src/components/organisms/form/fields/index.js +1 -0
  43. package/src/components/organisms/navigation/index.js +4 -4
  44. package/src/components/organisms/search/index.js +13 -16
  45. package/src/components/organisms/toplist/list/list.test.js +10 -2
  46. package/src/components/pages/body/index.js +2 -2
  47. package/src/components/pages/search/index.js +71 -53
  48. package/src/components/pages/tracker/index-ssr.js +4 -8
  49. package/src/components/pages/tracker/index.js +3 -7
  50. package/src/components/pages/tracker-geo/index-ssr.js +3 -7
  51. package/src/components/pages/tracker-geo/index.js +3 -7
  52. package/src/constants/forms.js +1 -1
  53. package/src/constants/pick-keys.mjs +7 -6
  54. package/src/helpers/getters.mjs +23 -5
  55. package/src/helpers/getters.test.js +15 -6
  56. package/src/helpers/processImageNode.js +53 -0
  57. package/src/helpers/processImageNode.test.js +41 -0
  58. package/src/helpers/processor/index.mjs +7 -4
  59. package/src/helpers/processor/modules.mjs +6 -66
  60. package/src/helpers/processor/operators.mjs +78 -0
  61. package/src/helpers/processor/operators.test.js +36 -0
  62. package/src/helpers/processor/relations.mjs +9 -30
  63. package/src/helpers/replaceMedia.js +2 -36
  64. package/src/helpers/schema.js +1 -1
  65. package/src/helpers/schema.test.js +2 -2
  66. package/src/helpers/search-source.js +3 -3
  67. package/src/helpers/search.js +1 -1
  68. package/src/helpers/server-data.js +28 -1
  69. package/src/helpers/strings.js +10 -0
  70. package/src/hooks/tabs/tabs.module.scss +2 -0
  71. package/src/images/icons/check.js +3 -3
  72. package/src/styles/utils/variables/_main.scss +2 -0
  73. package/tests/factories/modules/card.factory.js +17 -12
  74. package/tests/factories/modules/footer.factory.js +2 -0
  75. package/tests/factories/modules/toplist.factory.js +1 -1
  76. package/tests/factories/pages/list.factory.js +7 -0
  77. package/tests/factories/pages/transformed-pages.factory.js +195 -0
  78. package/tests/factories/relations/operator.factory.js +22 -0
  79. package/tests/factories/search/data.json +299532 -0
  80. package/src/components/molecules/search/search.testttt.js +0 -114
package/CHANGELOG.md CHANGED
@@ -1,3 +1,60 @@
1
+ ## [33.1.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v33.1.0...v33.1.1) (2024-06-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix relation pick keys for email and url ([a3cff32](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a3cff3220c99d07e84de76d27e179113027b6164))
7
+ * search logic ([214d773](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/214d77330cdeb0a09fc7232a1d05903072995611))
8
+
9
+
10
+ ### Code Refactoring
11
+
12
+ * add games amount to operator relation ([d20e0dc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d20e0dcfaacf439f2717b2cebe4953062c0516ae))
13
+ * change to button titles ([1a430e1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1a430e19b831d1e23b8edacbc67263b7b7464317))
14
+ * changes to aria-labels and buttons ([4d57af5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4d57af5349b06ae606b58c1a2c015488f98fe605))
15
+ * changes to search button ([f0f0e9f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f0f0e9ffbe25a10c4c1e0584bac696e09b06f480))
16
+
17
+
18
+ * Merge branch 'tm-4505' into 'master' ([d085a9e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d085a9e467dc3f139e99e05281186022f012dfcd))
19
+
20
+ # [33.1.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v33.0.2...v33.1.0) (2024-06-20)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * add alt text ([ff4455a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ff4455a521d4436df2c2dc5e8cf71fc457af39df))
26
+ * added conditional indexing ([85fbd8e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/85fbd8eb1cedf0c65343a0f1ffbeb4d2890c0319))
27
+ * added sanitize operator by market ([db27fc1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/db27fc12cad16cce357536ee6aa3f424454bd894))
28
+ * added sanitize operator function + fixed references + testing ([2810f91](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2810f91efb44fd0f631c6bfd029a434e0f75fca4))
29
+ * forgoten variable ([c4267b1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c4267b19be1b61c88996f04f48774cef15e564b5))
30
+ * image resize core ([5e40d81](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5e40d81917389e2cee668b0f12c9fb3a0037e014))
31
+ * jest ([ba4b7c0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ba4b7c02f0654f6831d9993245f5cf939121cbef))
32
+ * search for multimarket ([bfe7b3a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/bfe7b3a0df3121061a1bf9c38b8180d1fd6ef46c))
33
+ * search showall and when no query is submitted ([07ad454](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/07ad454c92304369e53e6ac8cfacd052abd68735))
34
+ * small changes ([ff60d70](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ff60d700a0722525e83cf96fa22adc723a205318))
35
+ * update naming ([0daa09e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0daa09e0c5e6a3e15b26c0aed3d28aad7f59698d))
36
+
37
+
38
+ ### Code Refactoring
39
+
40
+ * changes to css var values ([b6a03d3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b6a03d3d277ad71b0c5a6523c9dc6847530cf4c0))
41
+ * changes to list padding ([43b7a84](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/43b7a845a131689d9d3b9512d9a268958e301f93))
42
+ * remove padding on list soon after headings ([c8f3f50](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c8f3f5068770d6f7bdb4fe55012623cad189bfff))
43
+
44
+
45
+ * Merge branch 'tm-4484-alt-text' into 'master' ([7328829](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/732882963632c20c413679990ccd2959bfc42367))
46
+ * Merge branch 'tm-4398-search-refactoring' into 'master' ([b37c19b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b37c19b2503f35ff0b7e8b226efcb2a41ff3ae61))
47
+ * Merge branch 'tm-4455-empty-menu' into 'master' ([567ea5b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/567ea5ba9390dd56dd9da7dccd24a91e6b6e57fe))
48
+ * Merge branch 'tm-4293-improvements-rg-template' into 'master' ([ae964f3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ae964f394c630007ced3163f661784c5622f782d))
49
+ * Merge branch 'tm-4428-sanitize-operator' into 'master' ([699b5e2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/699b5e22133830bf6262b16c85620a167496de37))
50
+ * Merge branch 'tm-4358-images-resize' into 'master' ([e95e129](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e95e12965538a84f07bd001f999d78a1947a35f4))
51
+ * Merge branch 'tm-4451-lists' into 'master' ([761a9a7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/761a9a7c8ffa82110edf3726b522331948e7bfde))
52
+
53
+
54
+ ### Features
55
+
56
+ * search refactoring and tests ([ad6989b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ad6989b5b2eff85bb6a41c750a9f3b9d6aa639ad))
57
+
1
58
  ## [33.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v33.0.1...v33.0.2) (2024-06-19)
2
59
 
3
60
 
package/gatsby-node.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-underscore-dangle */
1
2
  /* eslint-disable import/no-extraneous-dependencies */
2
3
  /* eslint-disable prefer-destructuring */
3
4
  /* eslint-disable no-unused-vars */
@@ -13,10 +14,11 @@ import { getData, getLocalData } from './src/helpers/api.mjs';
13
14
 
14
15
  import { generateTrackerLink } from './src/helpers/generators.mjs';
15
16
  import processor, { processSitemapPages } from './src/helpers/processor/index.mjs';
16
- import { pickAuthorsPageKeys } from './src/constants/pick-keys.mjs';
17
+ import { pickAuthorsPageKeys, pickRelationKeys } from './src/constants/pick-keys.mjs';
17
18
  import settings from './src/constants/settings.mjs';
18
19
  import { translate } from './src/helpers/getters.mjs';
19
20
  import { groupBy } from './src/helpers/processor/common.mjs';
21
+ import { sanitizeOperatorData } from './src/helpers/processor/operators.mjs';
20
22
 
21
23
  const __dirname = dirname(fileURLToPath(import.meta.url));
22
24
  const { cloneDeep, chunk, pick } = loadash;
@@ -297,11 +299,19 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
297
299
  templates,
298
300
  },
299
301
  });
302
+ } else if (page.path === `${pathPrefix || ''}s`) {
303
+ createPage({
304
+ path: `/${page.path}`,
305
+ component: `${__dirname}/src/components/app-ssr.js`,
306
+ context: {
307
+ ...contextData,
308
+ isPreview: page.path === 'preview',
309
+ },
310
+ });
300
311
  } else {
301
- const component =
302
- settings.app_ssr.includes(page.template)
303
- ? `${__dirname}/src/components/app-ssr.js`
304
- : `${__dirname}/src/components/app.js`;
312
+ const component = settings.app_ssr.includes(page.template)
313
+ ? `${__dirname}/src/components/app-ssr.js`
314
+ : `${__dirname}/src/components/app.js`;
305
315
 
306
316
  createPage({
307
317
  path: page.path.charAt(0) === '/' ? page.path : `/${page.path}`,
@@ -392,7 +402,10 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
392
402
  meta_robots: ['noindex', 'nofollow'],
393
403
  };
394
404
 
395
- const trackerComp = process.env.IS_TRACKING_SSR === 'true' ? `${__dirname}/src/components/pages/tracker-geo/index-ssr.js` : `${__dirname}/src/components/pages/tracker-geo/index.js`;
405
+ const trackerComp =
406
+ process.env.IS_TRACKING_SSR === 'true'
407
+ ? `${__dirname}/src/components/pages/tracker-geo/index-ssr.js`
408
+ : `${__dirname}/src/components/pages/tracker-geo/index.js`;
396
409
 
397
410
  createPage({
398
411
  path: trackerLinkPath,
@@ -400,7 +413,12 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
400
413
  context: {
401
414
  page: trackerPageObject,
402
415
  siteInfo,
403
- operatorsByMarket,
416
+ operator: Object.fromEntries(
417
+ Object.entries(operatorsByMarket).map(([key, operator]) => [
418
+ key,
419
+ pick(cloneDeep(sanitizeOperatorData(operator)), pickRelationKeys.operator)
420
+ ])
421
+ ),
404
422
  isTrackeGeo: true,
405
423
  isLiveStreamProvider: false,
406
424
  },
@@ -443,7 +461,7 @@ export const createPages = async ({ actions: { createPage } }, themeOptions) =>
443
461
  page: trackerPageObject,
444
462
  translations: processed.relations.translations[marketOperator],
445
463
  siteInfo,
446
- operator,
464
+ operator: pick(cloneDeep(sanitizeOperatorData(operator, [], [], translations, [])), pickRelationKeys.operator),
447
465
  isTracker: true,
448
466
  isLiveStreamProvider: false,
449
467
  },
package/jest.config.js CHANGED
@@ -18,16 +18,18 @@ module.exports = {
18
18
  '^~context(.*)$': '<rootDir>/src/context$1',
19
19
  '^~constants(.*)$': '<rootDir>/src/constants$1',
20
20
  // JSON Data
21
- 'data.json': '<rootDir>/__mocks__/search-data.json',
21
+ // 'data.json': '<rootDir>/__mocks__/search-data.json',
22
22
  '^gatsby-plugin-utils/(.*)$': [`gatsby-plugin-utils/dist/$1`, `gatsby-plugin-utils/$1`],
23
23
  '^gatsby-core-utils/(.*)$': `gatsby-core-utils/dist/$1`,
24
24
  },
25
25
  // testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
26
26
  coveragePathIgnorePatterns: [
27
27
  'tests/helpers',
28
- 'src/components/organisms/search',
29
- 'src/components/molecules/search',
28
+ 'src/components/organisms/carousel',
29
+ 'src/components/atoms/author-box',
30
+ 'src/components/pages/search',
30
31
  'src/components/app.js',
32
+ 'src/components/app-ssr.js',
31
33
  ],
32
34
  transformIgnorePatterns: [`node_modules/(?!(gatsby|gatsby-script|gatsby-link)/)`],
33
35
  globals: {
@@ -41,7 +43,7 @@ module.exports = {
41
43
  collectCoverage: true,
42
44
  coverageThreshold: {
43
45
  global: {
44
- statements: 79,
46
+ statements: 81,
45
47
  },
46
48
  },
47
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "33.0.2",
3
+ "version": "33.1.1",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -88,9 +88,10 @@ AppSSR.propTypes = {
88
88
  serverData: PropTypes.any,
89
89
  };
90
90
 
91
- export async function getServerData({ pageContext, url }) {
91
+ export async function getServerData(props) {
92
+ const { pageContext, url, query, headers } = props;
92
93
  let res = '';
93
- res = await getAPIData(pageContext.page, url);
94
+ res = await getAPIData(pageContext.page, query.s ? url : headers.get('referer'));
94
95
  return res;
95
96
  }
96
97
  export default AppSSR;
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { render, screen, cleanup, waitFor } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+ import { act } from 'react-dom/test-utils';
5
+ import getAuthorList from '../../../../tests/factories/authors/author.factory';
6
+
7
+ import Index from '.';
8
+
9
+ describe('Author Box Tests', () => {
10
+ test('render template one', async () => {
11
+ const currentAuthor = getAuthorList({ count: 1 })[1];
12
+ // eslint-disable-next-line react/style-prop-object
13
+ const args = {
14
+ author: currentAuthor,
15
+ style: 'template_one',
16
+ };
17
+
18
+ await act(async () => {
19
+ render(<Index {...args} />);
20
+ });
21
+
22
+ // Use waitFor or findBy* methods to wait for elements to appear
23
+ await waitFor(() => {
24
+ const authorBox = document.getElementById('authorbox');
25
+ expect(authorBox).toBeInTheDocument();
26
+ });
27
+ });
28
+
29
+ test('render template two', async () => {
30
+ const currentAuthor = getAuthorList({ count: 1 })[1];
31
+ // eslint-disable-next-line react/style-prop-object
32
+ const args = {
33
+ author: currentAuthor,
34
+ style: 'template_two',
35
+ };
36
+
37
+ await act(async () => {
38
+ render(<Index {...args} />);
39
+ });
40
+
41
+ // Use waitFor or findBy* methods to wait for elements to appear
42
+ await waitFor(() => {
43
+ const authorBox = document.getElementById('authorbox');
44
+ expect(authorBox).toBeInTheDocument();
45
+ });
46
+ });
47
+
48
+ test('render template three', async () => {
49
+ const currentAuthor = getAuthorList({ count: 1 })[1];
50
+ // eslint-disable-next-line react/style-prop-object
51
+ const args = {
52
+ author: currentAuthor,
53
+ style: 'template_three',
54
+ };
55
+
56
+ await act(async () => {
57
+ render(<Index {...args} />);
58
+ });
59
+
60
+ // Use waitFor or findBy* methods to wait for elements to appear
61
+ await waitFor(() => {
62
+ const authorBox = document.getElementById('authorbox');
63
+ expect(authorBox).toBeInTheDocument();
64
+ });
65
+ });
66
+ });
67
+ afterEach(() => {
68
+ cleanup();
69
+ });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
2
+ import { render, cleanup, fireEvent } from '@testing-library/react';
3
3
  import '@testing-library/jest-dom/extend-expect';
4
4
 
5
5
  import { authorObject } from '~tests/factories/modules/author-box.factory';
@@ -22,7 +22,9 @@ describe('author box component', () => {
22
22
  author.biography =
23
23
  "The purpose of lorem ipsum is to create a natural looking block of text (sentence, paragraph, page, etc.) that doesn't distract from the layout";
24
24
 
25
- const { container, getByText } = render(<AuthorBox author={author} />);
25
+ const { container, getByText, getByRole } = render(<AuthorBox author={author} />);
26
+ const readMoreButton = getByRole('button');
27
+ fireEvent.click(readMoreButton);
26
28
 
27
29
  expect(container).toBeTruthy();
28
30
  expect(getByText(author.biography)).toBeTruthy();
@@ -9,9 +9,9 @@ export default function Expertion({ expertise }) {
9
9
  {expertise && (
10
10
  <div className={styles.expertion}>
11
11
  <p>Expert on:</p>
12
- {expertise?.map((res) => (
12
+ {expertise?.map((res, index) => (
13
13
  <span>
14
- <Check />
14
+ <Check id={`${res}_${index}`} />
15
15
  {res}
16
16
  </span>
17
17
  ))}
@@ -28,6 +28,13 @@ function Button({
28
28
  }
29
29
 
30
30
  const linkAttr = to ? { href: to } : { onClick };
31
+ let extraProps;
32
+
33
+ if (onClick) {
34
+ extraProps = {
35
+ role: 'button',
36
+ };
37
+ }
31
38
 
32
39
  return (
33
40
  <a
@@ -37,6 +44,7 @@ function Button({
37
44
  rel="nofollow noreferrer"
38
45
  className={`${classes || ''}`}
39
46
  {...linkAttr}
47
+ {...extraProps}
40
48
  >
41
49
  {btnText}
42
50
  {icon && icon}
@@ -94,9 +94,6 @@ const OperatorCtaButton = ({
94
94
  title={`${typeof translateBtn === 'string' ? translateBtn : ''} ${
95
95
  titleSuffix || ''
96
96
  }`.trimEnd()}
97
- aria-label={`${typeof translateBtn === 'string' ? translateBtn : ''} ${
98
- titleSuffix || ''
99
- }`.trimEnd()}
100
97
  className={`${classes || ''} ${gtmClass || ''}`}
101
98
  >
102
99
  {translateBtn}
@@ -3,7 +3,7 @@
3
3
  height: 4.8rem;
4
4
  position: relative;
5
5
  @include min(tablet) {
6
- max-width: 30rem;
6
+ width: 60%;
7
7
  margin-left: auto;
8
8
  }
9
9
  .select {
@@ -18,6 +18,7 @@
18
18
  color: var(--color-22);
19
19
  font-weight: 700;
20
20
  box-shadow: 0 0.1rem 0.2rem 0 rgba(0, 0, 0, 0.2);
21
+ max-width: 100%;
21
22
 
22
23
  &:after {
23
24
  @include arrow(var(--color-22), 1rem, down, false);
@@ -48,6 +49,6 @@
48
49
  font-weight: 700;
49
50
  color: var(--color-22);
50
51
  width: 100%;
51
- text-align: left;
52
+ text-align: left;
52
53
  }
53
54
  }
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-unused-expressions */
2
2
  import React from 'react';
3
- import { render, cleanup } from '@testing-library/react';
3
+ import { render, cleanup, fireEvent } from '@testing-library/react';
4
4
  import '@testing-library/jest-dom/extend-expect';
5
5
  import Disclaimer from '.';
6
6
 
@@ -10,9 +10,13 @@ describe('Disclaimer Component', () => {
10
10
  const func = require('../../../helpers/device-detect');
11
11
  func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
12
12
  const { container } = render(<Disclaimer dmcaImage="../../../../../images/dmca.png" />);
13
+
13
14
  expect(container.querySelector('img')).toBeTruthy();
14
15
  expect(container.querySelector('img')).toHaveAttribute('src', '../../../../../images/dmca.png');
15
16
  expect(container.querySelector('img')).toHaveAttribute('loading', 'eager');
17
+
18
+ const Button = container.querySelector('a');
19
+ fireEvent.click(Button);
16
20
  });
17
21
  });
18
22
  afterEach(() => {
@@ -25,6 +25,33 @@ describe('Menu Component', () => {
25
25
  expect(container.querySelectorAll('.menuItem.level1 > ul').length).toEqual(1);
26
26
  expect(container.querySelectorAll('.menuItem.level1 > ul > li').length).toEqual(4);
27
27
  expect(container.querySelectorAll('ul')).toHaveLength(5);
28
+
29
+ const Button = container.querySelector('li');
30
+ fireEvent.click(Button);
31
+ fireEvent.focus(Button);
32
+ });
33
+ });
34
+
35
+ test('render menu and lists on mobile', async () => {
36
+ Object.defineProperty(window.navigator, 'userAgent', {
37
+ value:
38
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1',
39
+ writable: true,
40
+ });
41
+
42
+ const { container } = render(<Items item={menus.children[3]} canOpenAllSubMenus={false} />);
43
+ const Button = container.querySelector('.menuItem.level1 > ul > li');
44
+ await waitFor(() => {
45
+ fireEvent.click(Button);
46
+ expect(container.querySelectorAll('.menuItem.level1 > ul > li.showSubMenu').length).toEqual(
47
+ 1
48
+ );
49
+
50
+ fireEvent.focus(Button);
51
+ fireEvent.mouseOver(Button);
52
+ fireEvent.keyDown(Button);
53
+
54
+ expect(container.querySelectorAll('ul')).toHaveLength(5);
28
55
  });
29
56
  });
30
57
  });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+
5
+ import NotFound from '.';
6
+
7
+ describe('Not Found Tests', () => {
8
+ test('test not found component', () => {
9
+ const { getAllByText } = render(<NotFound />);
10
+ expect(getAllByText('Oops, Something Went Wrong.')).toHaveLength(1);
11
+ });
12
+ });
13
+ afterEach(() => {
14
+ cleanup();
15
+ });
@@ -8,7 +8,7 @@ import styles from './operator.module.scss';
8
8
 
9
9
  const Operator = ({ item = {}, width = '56', height = '56' }) => {
10
10
  const { relation } = item;
11
- const img = relation?.standardised_logo_url_object?.filename || relation.logo_url;
11
+ const img = relation?.logo?.filename;
12
12
 
13
13
  return (
14
14
  <div className={styles.row || ''}>
@@ -28,7 +28,7 @@ Operator.propTypes = {
28
28
  item: PropTypes.shape({
29
29
  title: PropTypes.string,
30
30
  relation: PropTypes.shape({
31
- logo_url: PropTypes.string,
31
+ logo: PropTypes.shape({}),
32
32
  }),
33
33
  }).isRequired,
34
34
  width: PropTypes.string,
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+
5
+ import Sitemap from '.';
6
+
7
+ const pageContext = {
8
+ sitemapData: {
9
+ ie_en: {
10
+ 1: [
11
+ {
12
+ title: 'test one',
13
+ path: '/test_one',
14
+ },
15
+ {
16
+ title: 'test two',
17
+ path: '/test_two',
18
+ },
19
+ {
20
+ title: 'test three',
21
+ path: '/test_three',
22
+ },
23
+ ],
24
+ 2: [
25
+ {
26
+ title: 'template page one',
27
+ path: '/template_page_one',
28
+ },
29
+ {
30
+ title: 'template page two',
31
+ path: '/template_page_two',
32
+ },
33
+ ],
34
+ 3: [
35
+ {
36
+ title: 'template two page',
37
+ path: 'template_teo_page',
38
+ },
39
+ ],
40
+ },
41
+ },
42
+ templates: {
43
+ ie_en: {
44
+ short_name: 'template one',
45
+ },
46
+ 2: {
47
+ short_name: 'template two',
48
+ },
49
+ 3: {
50
+ short_name: 'template three',
51
+ },
52
+ },
53
+ };
54
+
55
+ describe('Sitemap Tests', () => {
56
+ test('test sitemap', () => {
57
+ const { getAllByText } = render(<Sitemap pageContext={pageContext} />);
58
+ expect(getAllByText('Link Icon')).toHaveLength(3);
59
+ });
60
+ });
61
+ afterEach(() => {
62
+ cleanup();
63
+ });
@@ -4,9 +4,9 @@ import Bonus from '.';
4
4
 
5
5
  describe('Bonus', () => {
6
6
  const operator = {
7
- standardised_logo_url: 'logo-url',
8
- logo: 'standardised-logo',
9
- logo_url: 'logo-url',
7
+ logo: {
8
+ filename: 'standardised-logo',
9
+ },
10
10
  bonus: {
11
11
  rating: '4.5',
12
12
  },
@@ -23,9 +23,7 @@ export default function Bonus({
23
23
  height = '120',
24
24
  showRoundedRating = false,
25
25
  }) {
26
- const { standardised_logo_url, logo_url, bonus, name } = operator || {};
27
- const logo = standardised_logo_url || logo_url;
28
-
26
+ const { logo, bonus, name } = operator || {};
29
27
  const showTncFixed = tncEnable && tncFixed;
30
28
 
31
29
  return (
@@ -46,9 +44,9 @@ export default function Bonus({
46
44
  >
47
45
  <LazyImage
48
46
  alt={operator?.name}
49
- src={imagePrettyUrl(logo, width, height)}
50
- height={height}
51
- width={width}
47
+ src={imagePrettyUrl(logo?.filename)}
48
+ height={120}
49
+ width={100}
52
50
  />
53
51
  <div className={styles.details}>
54
52
  {(bonus?.operator_name || name) && <span>{bonus?.operator_name || name}</span>}
@@ -82,9 +80,7 @@ export default function Bonus({
82
80
 
83
81
  Bonus.propTypes = {
84
82
  operator: PropTypes.shape({
85
- standardised_logo_url: PropTypes.string,
86
- logo: PropTypes.string,
87
- logo_url: PropTypes.string,
83
+ logo: PropTypes.shape({}),
88
84
  bonus: PropTypes.shape({
89
85
  rating: PropTypes.string,
90
86
  }),
@@ -18,9 +18,7 @@ function renderComponent(operator) {
18
18
 
19
19
  describe('TemplateOne', () => {
20
20
  const operator = {
21
- standardised_logo_url: 'logo_st',
22
21
  logo: 'logo',
23
- logo_url: 'logo-url',
24
22
  bonus: {
25
23
  rating: '4.5',
26
24
  },
@@ -31,8 +31,7 @@ export default function TemplateOne({
31
31
  height = '120',
32
32
  }) {
33
33
  const { translations } = useContext(Context) || {};
34
- const { standardised_logo_url, logo_url, bonus, name } = operator || {};
35
- const logo = standardised_logo_url || logo_url;
34
+ const { logo, bonus, name } = operator || {};
36
35
 
37
36
  const showTncFixed = tncEnable && tncFixed;
38
37
 
@@ -66,7 +65,7 @@ export default function TemplateOne({
66
65
  >
67
66
  <LazyImage
68
67
  alt={operator?.name}
69
- src={imagePrettyUrl(logo, width, height)}
68
+ src={imagePrettyUrl(logo?.filename, 120, 120)}
70
69
  loading="eager"
71
70
  height={height}
72
71
  width={width}
@@ -120,9 +119,7 @@ TemplateOne.propTypes = {
120
119
  closedBanner: PropTypes.bool,
121
120
  setClosedBanner: PropTypes.func,
122
121
  operator: PropTypes.shape({
123
- standardised_logo_url: PropTypes.string,
124
- logo: PropTypes.string,
125
- logo_url: PropTypes.string,
122
+ logo: PropTypes.shape({}),
126
123
  bonus: PropTypes.shape({
127
124
  rating: PropTypes.string,
128
125
  }),
@@ -50,7 +50,7 @@ const Content = ({
50
50
  `}
51
51
  >
52
52
  {parse(content, {
53
- replace: (node) => replaceMedia(node, page, translations),
53
+ replace: (node) => replaceMedia(node, page, translations, moduleWidth),
54
54
  })}
55
55
  </div>
56
56
  );
@@ -78,10 +78,13 @@ const Content = ({
78
78
  {mainContent(module.value)}
79
79
  <button
80
80
  type="button"
81
- className={`${isContentCollapsible ? styles.showMoreTwoButton : styles.showMoreButton} ${
82
- !isContentCollapsible && showMore && styles.hide
83
- } ${showMore && isContentCollapsible && styles.showMoreTwoButtonOpen}`}
81
+ className={`${
82
+ isContentCollapsible ? styles.showMoreTwoButton || '' : styles.showMoreButton || ''
83
+ } ${(!isContentCollapsible && showMore && styles.hide) || ''} ${
84
+ (showMore && isContentCollapsible && styles.showMoreTwoButtonOpen) || ''
85
+ }`}
84
86
  onClick={handleChange}
87
+ title="showMoreContentButton"
85
88
  >
86
89
  {show_more_label}
87
90
  {icon && isContentCollapsible && icon}
@@ -4,7 +4,7 @@
4
4
  color: #515156;
5
5
  font-size: 1.6rem;
6
6
  list-style-position: inside;
7
- padding: 0 1.6rem 1.6rem 5.3rem;
7
+ padding: var(--content-list-padding, 1.6rem 1.6rem 1.6rem 5.3rem);
8
8
  font-weight: 400;
9
9
  line-height: 27px;
10
10
  li {
@@ -50,7 +50,7 @@
50
50
 
51
51
  ol {
52
52
  list-style-type: decimal;
53
- padding: 0 1.6rem 1.6rem 5.2rem;
53
+ padding: var(--content-list-padding, 1.6rem 1.6rem 1.6rem 5.2rem);
54
54
 
55
55
  li {
56
56
  counter-increment: li;
@@ -95,4 +95,16 @@
95
95
  list-style-position: inside;
96
96
  margin-left: 1.5rem;
97
97
  }
98
+
99
+ p:not(:last-of-type),
100
+ h2,
101
+ h3,
102
+ h4,
103
+ h5,
104
+ h6 {
105
+ + ol,
106
+ + ul {
107
+ padding-top: var(--content-list-last-padding, 0);
108
+ }
109
+ }
98
110
  }