gatsby-core-theme 2.2.4 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/__mocks__/gatsby.js +16 -4
  3. package/gatsby-node.esm.js +14 -16
  4. package/jest.config.js +8 -1
  5. package/package.json +1 -1
  6. package/src/components/app.js +1 -17
  7. package/src/components/atoms/author/author.test.js +12 -5
  8. package/src/components/atoms/author-box/index.js +6 -5
  9. package/src/components/atoms/breadcrumbs/breadcrumbs.test.js +8 -0
  10. package/src/components/atoms/carousel/pagination-item/pagination-item.test.js +18 -3
  11. package/src/components/atoms/collapse/collapse.test.js +10 -0
  12. package/src/components/atoms/collapse/index.js +3 -1
  13. package/src/components/atoms/content-box/content-box.test.js +9 -6
  14. package/src/components/atoms/content-box/index.js +13 -12
  15. package/src/components/atoms/custom-select/index.js +31 -30
  16. package/src/components/atoms/disclaimer/disclaimer.test.js +16 -1
  17. package/src/components/atoms/iframe/iframe.module.scss +3 -0
  18. package/src/components/atoms/iframe/iframe.test.js +6 -0
  19. package/src/components/atoms/iframe/index.js +1 -1
  20. package/src/components/atoms/image/image.test.js +19 -6
  21. package/src/components/atoms/image/index.js +2 -4
  22. package/src/components/atoms/info-grid/index.js +10 -12
  23. package/src/components/atoms/label/index.js +2 -2
  24. package/src/components/atoms/label/label.test.js +4 -0
  25. package/src/components/atoms/menu/items/item/item.module.scss +4 -0
  26. package/src/components/atoms/module-title/index.js +9 -9
  27. package/src/components/atoms/module-title/module-title.test.js +76 -0
  28. package/src/components/atoms/open-graph/open-graph.test.js +34 -5
  29. package/src/components/atoms/operator-cta/operator-cta.test.js +26 -3
  30. package/src/components/atoms/scroll-to-top/scroll-to-top.test.js +6 -0
  31. package/src/components/atoms/search/autocomplete/operator.js +1 -1
  32. package/src/components/atoms/sitemap/index.js +1 -1
  33. package/src/components/atoms/spotlights/index.js +55 -53
  34. package/src/components/atoms/spotlights/spotlights.module.scss +25 -37
  35. package/src/components/atoms/spotlights/spotlights.test.js +13 -15
  36. package/src/components/molecules/content/content.test.js +127 -0
  37. package/src/components/molecules/content/index.js +2 -2
  38. package/src/components/molecules/header/header.test.js +6 -0
  39. package/src/components/molecules/main/main.test.js +48 -12
  40. package/src/components/molecules/menu/menu.test.js +27 -0
  41. package/src/components/molecules/module/module.test.js +134 -0
  42. package/src/components/molecules/operator-banner/operator-banner.test.js +7 -1
  43. package/src/components/molecules/pagination/pagination-with-midpoints.module.scss +48 -49
  44. package/src/components/organisms/anchor/index.js +1 -1
  45. package/src/components/organisms/cookie-consent/cookie-consent.test.js +7 -1
  46. package/src/components/organisms/form/form.test.js +21 -0
  47. package/src/components/organisms/form/index.js +5 -1
  48. package/src/components/organisms/navigation/index.js +9 -1
  49. package/src/components/organisms/search/index.js +0 -1
  50. package/src/components/organisms/toplist/list/index.js +1 -1
  51. package/src/components/organisms/toplist/list/list.test.js +30 -0
  52. package/src/components/pages/body/index.js +22 -5
  53. package/src/components/pages/tracker/index.js +1 -1
  54. package/src/constants/settings.js +1 -1
  55. package/src/helpers/getters.js +1 -6
  56. package/src/helpers/getters.test.js +1 -3
  57. package/src/helpers/processor/common.test.js +7 -1
  58. package/src/helpers/processor/index.js +2 -3
  59. package/src/helpers/processor/index.test.js +21 -0
  60. package/src/helpers/schema.js +30 -3
  61. package/src/helpers/schema.test.js +19 -10
  62. package/src/helpers/strings.js +10 -0
  63. package/src/helpers/strings.test.js +8 -0
  64. package/src/hooks/gatsby-img/index.js +1 -1
  65. package/src/hooks/lazy-image/index.js +1 -1
  66. package/src/hooks/lazy-image/lazy-image.test.js +39 -0
  67. package/src/hooks/lazy-picture/index.js +1 -1
  68. package/src/hooks/link/link.test.js +42 -1
  69. package/src/hooks/tabs/tab/tab.test.js +41 -0
  70. package/src/styles/utils/variables/_main.scss +3 -1
  71. package/tests/envVars.js +1 -1
  72. package/tests/factories/modules/content.factory.js +6 -3
  73. package/tests/factories/modules/modules.factory.js +152 -0
  74. package/tests/factories/modules/schema.factory.js +87 -0
  75. package/tests/factories/pages/list.factory.js +2 -1
  76. package/tests/factories/pages/pages.factory.js +192 -0
  77. package/tests/factories/sections/header.factory.js +8 -2
  78. package/src/components/atoms/logo/index.js +0 -36
  79. package/src/components/atoms/logo/logo.module.scss +0 -4
  80. package/src/components/atoms/logo/logo.stories.js +0 -57
  81. package/src/components/atoms/logo/logo.test.js +0 -30
  82. package/src/components/molecules/section/index.js +0 -24
  83. package/src/components/molecules/section/section.test.js +0 -16
  84. package/src/components/molecules/sidebar/index.js +0 -25
  85. package/src/components/molecules/sidebar/sidebar.module.scss +0 -3
  86. package/src/components/molecules/sidebar/sidebar.test.js +0 -30
package/CHANGELOG.md CHANGED
@@ -1,3 +1,128 @@
1
+ # [4.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v3.0.0...v4.0.0) (2022-02-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add global variable for pagination border ([6046cad](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6046cad5a846f41220e3a6a7cbf5105c04d2f9a1))
7
+ * added custom styles ([9d4f51c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9d4f51cf96fba24b50b60dce92565c86b9f21334))
8
+ * fix conflicts ([b5fb9c6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b5fb9c6972488ece497a2d5b50a63d7799f63358))
9
+ * fix unit testing ([66f57d3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/66f57d3d4e8192eeb72f852d9834e0d58077a48a))
10
+ * fix unit testing ([88abd13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88abd1380c574cadd4c064580e458a862da71590))
11
+ * fix unit testing ([0497042](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0497042d8dc9aadae5f0d49e34ab8d1b3fa0663e))
12
+ * fixed prelive path condition ([b7bf68f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b7bf68fc29de038bf23988d0a16eca3ef5ef9f52))
13
+ * fixed unit testing ([8837446](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88374469c79e64b7e9f04a1ab3c18bc011adc99f))
14
+ * improve test for cookie and lazy ([7cc8a7d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7cc8a7da3bc8ffcaffb3b7326eecc0606c648f8c))
15
+ * improve unit testing ([0fbf8fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0fbf8fcd9e7a1df4d67bfc8e1b82eb433975850c))
16
+ * make unit testing ([7938019](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/793801915c7ccd835ca1976b83824416b86b8126))
17
+ * spotlight tests ([13f617c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/13f617c25ce7a2df84aec7acda9783c63890f59e))
18
+
19
+
20
+ ### Code Refactoring
21
+
22
+ * add variables to pipeline ([3c7b842](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3c7b8422769ffbc4196fc01770e2fd6df8f29923))
23
+ * changes to variables ([3b5a5a3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3b5a5a31a9de8430e611615b885c387b0f2551b9))
24
+ * cleaning up spotlights module ([9b8c181](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9b8c181311b0dbd5cee0748e239b6ea96c713dea))
25
+ * merge master to branch ([c4de93c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c4de93c2151a1f681bc7b93515c3e0e7ea606185))
26
+ * remove some unneeded components ([d29df5d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d29df5d0d112ed70fd56da3c5d749daf8e3c9008))
27
+ * remove test data ([8e3c0d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e3c0d60652e6a9f9b8541cccebc107c2d14a33d))
28
+ * remove unneeded check ([8007c96](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8007c967a82f5c216bc9196e35b67c1372e882a5))
29
+ * remove unused pipeline ([f4ba474](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f4ba474b9aa4bda20f1dae293888ee6869823023))
30
+ * test new pipeline ([afbda7c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/afbda7c3885959cebb2a3e1194dbad352b96a50d))
31
+ * test new pipeline ([74b1667](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/74b1667773a1bbf68e221dc9d990375b4efd61d1))
32
+ * test new pipeline ([0070134](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0070134d06fc8ef0ab8bb59dd82ff9a9a8bbf41f))
33
+ * test new pipeline ([8e4a07f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e4a07f910753d911b02b8e71d01f357ac98b3d0))
34
+ * test new pipeline ([918dede](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/918dede9f7bcac0dbc89d8a01797765732039b90))
35
+ * test new pipeline ([38f1572](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/38f15727f255602e46fad0deef41a80a07b2b5e8))
36
+ * update getPageImage conditionals for readability ([3026c02](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3026c02141ec1eb84e4347309571fa22fcf258c4))
37
+ * update img alt tags ([234ae5e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/234ae5eb892fc437197b79393508da69bc5b768e))
38
+ * update schema publisher logo check ([9cffb56](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9cffb5661157b3b7e8b549682b72628f4ce3aa04))
39
+ * update tracker pages pageImage generation ([6c6c86f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6c6c86f2eaab60d580f05d9a1c79e19ff1523adf))
40
+
41
+
42
+ ### Config
43
+
44
+ * increased threshold ([ef1c310](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef1c31023312841b11af983dab5a5a189124e06a))
45
+
46
+
47
+ * Merge branch 'tm-2624-spotlight-custom-styles' into 'master' ([18d168b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/18d168befd09fd279bc4a0e775f6a230df303fa0))
48
+ * Merge branch 'tm-2738-trackers-page-image' into 'master' ([cfc1fb4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cfc1fb413ca4350e2b9b73f72b58e688966eb108))
49
+ * Merge branch 'tm-2715-update-img-alt-tags' into 'master' ([fbbbad6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fbbbad60e6abc08cfc9c971519023177bbb61ad1))
50
+ * Merge branch 'master' into 'tm-2715-update-img-alt-tags' ([b27f85f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b27f85faeb6e843a0d12733635c1524239176b85))
51
+ * Merge branch 'tm-2716-html-cleanup' into 'master' ([83ff1de](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/83ff1de24d90207235833f43093c58edb519d0c4))
52
+ * Merge branch 'master' into 'tm-2715-update-img-alt-tags' ([ab98ebd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ab98ebd2ac7a220b4dcaa54ff87d68c1d23529c8))
53
+ * Merge branch 'tm-2706-custom-demo-deployment' into 'master' ([006e13d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/006e13d08f2bb435e99fb35f1bfec76f3f0c2590))
54
+ * Merge branch 'master' into tm-2706-custom-demo-deployment ([eb2483d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eb2483d76b494627555568ee2213ea7b8c6264a7))
55
+ * Merge branch 'tm-2699-unit-testing' into 'master' ([e36d06d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e36d06d8cd96bb92468047c319cb467ecdbd9980))
56
+ * Merge branch 'tm-2681-canary-tokens' into 'master' ([d70add6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d70add68ba2ba599f6e44d6686f108c68490168c))
57
+ * Merge branch 'tm-2705-gatsby-deployment-refactor' into 'master' ([d8dbeb2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8dbeb238502552d90e7092bca277a3f8873104a))
58
+ * Merge branch 'master' into tm-2705-gatsby-deployment-refactor ([2a11b10](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2a11b1015cf497661cc05ff3eb447921236fe0cc))
59
+
60
+ # [3.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.6...v3.0.0) (2022-02-08)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * added canarty token ([4f038a9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4f038a9f580fdd4cf7fe113e7a3bac981e5958a8))
66
+ * final fixes ([5ff5dbe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5ff5dbe6954d55406e562a6dc92aba29f180e649))
67
+ * final fixes ([d6ab5b4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d6ab5b43137c9e86ed700e9835546081e5a281cc))
68
+ * final fixes ([3e0b2c2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3e0b2c24bd1ecb4788adff18499c8be08e4571f9))
69
+ * fixed issues ([41c60c3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/41c60c3cd190b6c8bc1ea3f3ffe78dd116bc4f06))
70
+ * fixed issues ([5cb7d46](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5cb7d464ea4f41259ff2429fe47df85401300a89))
71
+ * fixed paths ([69d1319](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/69d131999cd7713bbfec58101adac95f1f626f19))
72
+ * fixed paths ([55f6c1b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/55f6c1b4805aae0a7fc502e00430ddf3e5e7f15f))
73
+ * fixed paths ([893e1f9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/893e1f94c60a57abe6575abbe81fbb8f9d7e04f9))
74
+ * image cdn links ([dfa9b65](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/dfa9b65f57dec6b0c5456f06c566d157f259df8f))
75
+ * small fix ([77ccc9a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/77ccc9a3425a3d23c68bf29aa7761b8738263b1a))
76
+ * updated config CDN image ([7a53e9c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7a53e9c7be4b443019e980a1229e030265b69001))
77
+
78
+
79
+ ### Code Refactoring
80
+
81
+ * add keep_releases to gatsby theme ([8b39c85](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8b39c85cae696ba1f39074a27ad1e244a84cf23f))
82
+ * add keep_releases to gatsby theme ([d5743c3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d5743c363920f5b6c6b36c2a19518297557871ca))
83
+ * remove unnecessary gtmclass on DOM element ([89ad28e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/89ad28ebe2b010ce25af7f7bb1c34f81b897bb0e))
84
+
85
+
86
+ ### Config
87
+
88
+ * added authors in pageContext ([a8cc96d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a8cc96de8ce015412116ef45c331742c66b8af87))
89
+
90
+
91
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([250e76c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/250e76cbda63a6b7d77429bd447e56c17fb466af))
92
+ * Merge branch 'tm-2681-canary-tokens' into 'master' ([552a8c7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/552a8c783d388a32b363e2415ee17481987e9d70))
93
+ * Merge branch 'tm-2705-gatsby-deployment-refactor' into 'master' ([008231a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/008231af369ad5bed03f2f9e5d7e2b72557ada99))
94
+ * Merge branch 'master' into tm-2705-gatsby-deployment-refactor ([2a545dc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2a545dc4d670dd4ba5e48611487db066ac790a71))
95
+ * Merge branch 'tm-2695-image_cdn' into 'master' ([a650c11](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a650c11d73b3b96e455c4295b5f746f055656d32))
96
+ * Update index.js ([393bd40](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/393bd40075c31591e75ea1e9196f04c2d36254f1))
97
+ * Update index.js ([06001ff](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/06001ffff715c6484c4684d188c38e76a3db7804))
98
+ * Update index.js ([e6c40c8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e6c40c8756da47a1275687cee35712522f671f3f))
99
+
100
+ ## [2.2.6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.5...v2.2.6) (2022-02-02)
101
+
102
+
103
+ ### Bug Fixes
104
+
105
+ * content image cdn ([3cbb875](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3cbb8756406365dd24814f4212797c52298f4acb))
106
+
107
+ ## [2.2.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.4...v2.2.5) (2022-02-01)
108
+
109
+
110
+ ### Bug Fixes
111
+
112
+ * content images url changed to main cdn ([eb71334](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eb71334aa843df6b68ff021b7bce89f72ba37cd7))
113
+ * navigation menu fix ([0ae522f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0ae522f85dc646e535787132770b415feb2c2ce7))
114
+
115
+
116
+ ### Code Refactoring
117
+
118
+ * update review publisher info in schema ([4be14d8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4be14d8d058af3132eabfc5f3d7edcb2b65ae2db))
119
+ * update schema publisher name with owned_by ([b1f41c3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b1f41c3161db39eb90afa11ff10584a5ed36e257))
120
+
121
+
122
+ * Merge branch 'tm-2685-content-images-cdn' into 'master' ([426ae80](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/426ae80f987034558cb2503dfda17c5757859897))
123
+ * Merge branch 'tm-2670-update-schema-and-tests' into 'master' ([c8d60fb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c8d60fb00dfbfdea9f335bc4d12ea1766df2b114))
124
+ * Merge branch 'navigation' into 'master' ([02eccb3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/02eccb39c3ea7f615fac6978950a25872c5f5df6))
125
+
1
126
  ## [2.2.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.3...v2.2.4) (2022-01-27)
2
127
 
3
128
 
@@ -1,12 +1,23 @@
1
- const React = require('react')
2
- const gatsby = jest.requireActual('gatsby')
1
+ const React = require('react');
2
+
3
+ const gatsby = jest.requireActual('gatsby');
3
4
 
4
5
  module.exports = {
5
6
  ...gatsby,
6
7
  graphql: jest.fn(),
7
8
  Link: jest.fn().mockImplementation(
8
9
  // these props are invalid for an `a` tag
9
- ({ activeClassName, activeStyle, getProps, innerRef, partiallyActive, ref, replace, to, ...rest }) =>
10
+ ({
11
+ activeClassName,
12
+ activeStyle,
13
+ getProps,
14
+ innerRef,
15
+ partiallyActive,
16
+ ref,
17
+ replace,
18
+ to,
19
+ ...rest
20
+ }) =>
10
21
  React.createElement('a', {
11
22
  ...rest,
12
23
  href: to,
@@ -14,4 +25,5 @@ module.exports = {
14
25
  ),
15
26
  StaticQuery: jest.fn(),
16
27
  useStaticQuery: jest.fn(),
17
- }
28
+ navigate: jest.fn(),
29
+ };
@@ -198,7 +198,8 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
198
198
  authors = response.authors;
199
199
 
200
200
  page.translations = {};
201
- // siteSchema and authors are added to page for schemaGenerator()
201
+ // siteInfo, siteSchema and authors are added to page for schemaGenerator()
202
+ page.siteInfo = siteInfo;
202
203
  page.siteSchema = siteSchema;
203
204
  page.authors = Object.keys(authors || {}).map((key) =>
204
205
  pick(authors[key], pickAuthorsPageKeys)
@@ -219,20 +220,11 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
219
220
  prefilledModules,
220
221
  siteInfo,
221
222
  translations,
223
+ authors,
222
224
  ...themeOptions,
223
225
  };
224
226
 
225
- if (page.path === 'contact-us') {
226
- createPage({
227
- path: `/${page.path}`,
228
- component: require.resolve('./src/components/app.js'),
229
- context: {
230
- ...contextData,
231
- siteSchema,
232
- authors,
233
- },
234
- });
235
- } else if (page.path === '404') {
227
+ if (page.path === '404') {
236
228
  context404 = contextData;
237
229
  } else if (page.path === 'sitemap') {
238
230
  createPage({
@@ -259,8 +251,8 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
259
251
  Object.keys(
260
252
  (processed.relations &&
261
253
  processed.relations.sports_data &&
262
- processed.relations.sports_data.providers)
263
- || {}
254
+ processed.relations.sports_data.providers) ||
255
+ {}
264
256
  ).forEach((providerId) => {
265
257
  const provider = processed.relations.sports_data.providers[providerId];
266
258
  const tracker = generateTrackerLink(provider, 'main');
@@ -278,7 +270,8 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
278
270
  component: require.resolve('./src/components/app.js'),
279
271
  context: {
280
272
  page: trackerPageObject,
281
- provider: provider,
273
+ siteInfo,
274
+ provider,
282
275
  isTracker: true,
283
276
  },
284
277
  });
@@ -307,7 +300,12 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
307
300
  createPage({
308
301
  path: trackerPath,
309
302
  component: require.resolve('./src/components/app.js'),
310
- context: { page: trackerPageObject, operator, isTracker: true },
303
+ context: {
304
+ page: trackerPageObject,
305
+ siteInfo,
306
+ operator,
307
+ isTracker: true,
308
+ },
311
309
  });
312
310
  }
313
311
  });
package/jest.config.js CHANGED
@@ -20,6 +20,13 @@ module.exports = {
20
20
  'data.json': '<rootDir>/__mocks__/search-data.json',
21
21
  },
22
22
  // testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
23
+ coveragePathIgnorePatterns: [
24
+ 'tests/helpers',
25
+ 'src/components/organisms/search',
26
+ 'src/components/molecules/search',
27
+ 'src/components/app.js',
28
+ // ''
29
+ ],
23
30
  transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`],
24
31
  globals: {
25
32
  __PATH_PREFIX__: ``,
@@ -29,7 +36,7 @@ module.exports = {
29
36
  collectCoverage: true,
30
37
  coverageThreshold: {
31
38
  global: {
32
- statements: 70,
39
+ statements: 80,
33
40
  },
34
41
  },
35
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "2.2.4",
3
+ "version": "4.0.0",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -8,7 +8,7 @@ import Body from '~pages/body';
8
8
  import Head from '~organisms/head';
9
9
 
10
10
  const App = ({ pageContext }) => {
11
- const { translations, isTracker, isPreview } = pageContext;
11
+ const { translations = {}, isTracker, isPreview } = pageContext;
12
12
  const [previewContext, setPreviewContext] = useState({});
13
13
  const [isLoading, setIsLoading] = useState({});
14
14
 
@@ -33,26 +33,10 @@ const App = ({ pageContext }) => {
33
33
  window.location = `${window.location.origin}/preview?path=/`;
34
34
  }
35
35
  getData(searchParams);
36
- // let { hi, bye } = await import('./say.js');
37
- // getPreview(pageContext.siteName, searchParams.get('path') || '/', pageContext).then(
38
- // (previewResponse) => {
39
- // setPreviewContext(previewResponse);
40
- // setIsLoading(false);
41
- // }
42
- // );
43
-
44
36
  globalHistory.listen(({ location }) => {
45
37
  setIsLoading(true);
46
38
 
47
39
  getData(null, location.search.replace('?path=', ''));
48
- // getPreview(pageContext.siteName, location.search.replace('?path=', ''), pageContext)
49
- // .then((previewResponse) => {
50
- // setPreviewContext(previewResponse);
51
- // setIsLoading(false);
52
- // })
53
- // .catch(() => {
54
- // alert('failed to load..');
55
- // });
56
40
  });
57
41
  }
58
42
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -10,30 +10,37 @@ describe('Author Component', () => {
10
10
  <Author
11
11
  name="mohsen"
12
12
  prefix="by"
13
+ authorProfile="/author"
13
14
  link="https://twitter.com/name"
14
15
  icon={<i className="twitter" />}
15
16
  />
16
17
  );
17
18
  expect(container.querySelector('.authorInfo')).toBeTruthy();
18
- const info = getByText('by mohsen');
19
+ const info = getByText('mohsen');
19
20
  expect(info).toBeTruthy();
20
21
  expect(container.querySelector('a').getAttribute('href')).toEqual('https://twitter.com/name');
21
22
  expect(container.querySelector('i.twitter')).toBeTruthy();
22
23
  });
23
24
 
24
25
  test('without link and icon', () => {
25
- const { container, getByText } = render(<Author name="mohsen" prefix="with" />);
26
+ const { container } = render(<Author name="mohsen" />);
26
27
  expect(container.querySelector('.authorInfo')).toBeTruthy();
27
- const info = getByText('with mohsen');
28
- expect(info).toBeTruthy();
29
28
  expect(container.querySelector('a')).toBeFalsy();
30
29
  });
31
30
 
32
31
  test('with date', () => {
33
- const { container, getByText } = render(<Author name="mohsen" prefix="with" date="2020-04-24 15:37:42" />);
32
+ const { container, getByText } = render(
33
+ <Author
34
+ name="mohsen"
35
+ icon={<i className="twitter" />}
36
+ prefix="with"
37
+ date="2020-04-24 15:37:42"
38
+ />
39
+ );
34
40
  expect(container.querySelector('.date')).toBeTruthy();
35
41
  const info = getByText('with mohsen');
36
42
  expect(info).toBeTruthy();
43
+ expect(container.querySelector('i')).toBeTruthy();
37
44
  expect(container.querySelector('a')).toBeFalsy();
38
45
  });
39
46
  });
@@ -1,7 +1,8 @@
1
+ /* eslint-disable react/no-danger */
1
2
  import React, { useContext } from 'react';
2
3
  import { FaInstagram, FaFacebookSquare, FaTwitter, FaLinkedin } from 'react-icons/fa';
3
4
  import PropTypes from 'prop-types';
4
- import { translate } from '~helpers/getters';
5
+ import { translate, imagePrettyUrl } from '~helpers/getters';
5
6
  import styles from './author-box.module.scss';
6
7
  import LazyImage from '~hooks/lazy-image';
7
8
  import Link from '~hooks/link';
@@ -19,15 +20,14 @@ export default function AuthorBox({ author }) {
19
20
  <div className={styles.container}>
20
21
  <div className={styles.innerContainer}>
21
22
  <div className={styles.information}>
22
- <div>
23
- {' '}
23
+ {author.image_object && (
24
24
  <LazyImage
25
- src={author.image_object?.url}
25
+ src={imagePrettyUrl(author.image_object.filename)}
26
26
  alt={author.image_alt}
27
27
  width={author.image_object?.width}
28
28
  height={author.image_object?.height}
29
29
  />
30
- </div>
30
+ )}
31
31
  <span className={styles.name}>{author.name}</span>
32
32
  <p className={styles.title}>{author.author_title}</p>
33
33
  </div>
@@ -108,6 +108,7 @@ AuthorBox.propTypes = {
108
108
  url: PropTypes.string,
109
109
  width: PropTypes.number,
110
110
  height: PropTypes.number,
111
+ filename: PropTypes.string,
111
112
  }),
112
113
  image_alt: PropTypes.string,
113
114
  name: PropTypes.string,
@@ -20,6 +20,14 @@ describe('Show Breadcrumbs in a page', () => {
20
20
  const { container } = render(<Breadcrumbs page={page} />);
21
21
  expect(container).toBeEmptyDOMElement();
22
22
  });
23
+ test('Breadcrumb when we dont have link', () => {
24
+ const page = {
25
+ ...getPageData(),
26
+ breadcrumbs: [{ label: 'Sport', path: null }],
27
+ };
28
+ const { container } = render(<Breadcrumbs page={page} />);
29
+ expect(container.querySelectorAll('a')).toHaveLength(1);
30
+ });
23
31
  test('Vanity label', () => {
24
32
  const page = {
25
33
  vanity_label: 'Alternative title',
@@ -9,18 +9,33 @@ const currentSlide = 3;
9
9
 
10
10
  describe('Pagination Item Component', () => {
11
11
  test('render pagination item', () => {
12
- const { container } = render(<PaginationItem slideIndex={currentSlide} type="dots" totalSlides={5} />);
12
+ const { container } = render(
13
+ <PaginationItem slideIndex={currentSlide} type="dots" totalSlides={5} />
14
+ );
13
15
  expect(container.querySelectorAll('button.paginationItem')).toHaveLength(5);
14
16
  expect(container.querySelectorAll('button.paginationItem.active')).toHaveLength(1);
15
17
  });
16
18
  test('on click', () => {
17
19
  const paginationClick = jest.fn();
18
20
 
19
- const { container } = render(<PaginationItem slideIndex={currentSlide} type="dots" totalSlides={5} paginationHandler={paginationClick} />);
21
+ const { container } = render(
22
+ <PaginationItem
23
+ slideIndex={currentSlide}
24
+ type="dots"
25
+ totalSlides={5}
26
+ paginationHandler={paginationClick}
27
+ />
28
+ );
20
29
  const paginationItemBtn = container.querySelector('button.paginationItem.active');
21
30
  fireEvent.click(paginationItemBtn);
31
+ fireEvent.keyDown(paginationItemBtn);
22
32
  expect(paginationClick).toHaveBeenCalled();
23
- expect(paginationClick).toHaveBeenCalledWith(3)
33
+ expect(paginationClick).toHaveBeenCalledWith(3);
34
+ });
35
+
36
+ test('render empty', () => {
37
+ const { container } = render(<PaginationItem totalSlides={0} />);
38
+ expect(container.querySelector('button')).toBeFalsy();
24
39
  });
25
40
  });
26
41
  afterEach(() => {
@@ -27,6 +27,16 @@ describe('Collapse Component', () => {
27
27
  // jest does not render the component, hence testing the actual layout cannot be done due to the collapse using scrollHeight.
28
28
  });
29
29
 
30
+ test('Open collapse with different initial height', () => {
31
+ const { container } = render(
32
+ <Collapse buttonText="Open" maxHeight={20} contentText="Content Text" />
33
+ );
34
+
35
+ const button = container.querySelector('button');
36
+ fireEvent.click(button);
37
+ expect(button.classList.contains('active')).toBeFalsy();
38
+ });
39
+
30
40
  test('Only Mobile', () => {
31
41
  const { container } = render(
32
42
  <Collapse buttonText="Open" contentText="Content Text" onlyMobile />
@@ -10,8 +10,9 @@ const Collapse = ({
10
10
  onlyMobile = false,
11
11
  onlyDesktop = false,
12
12
  initOpen = false,
13
+ maxHeight = 0,
13
14
  }) => {
14
- const [maxHeightStyle, setMaxHeightStyle] = useState(0);
15
+ const [maxHeightStyle, setMaxHeightStyle] = useState(maxHeight);
15
16
  const contentRef = useRef(React.createRef());
16
17
  let showButton = true;
17
18
  const isMobile = useIsMobile();
@@ -68,6 +69,7 @@ Collapse.propTypes = {
68
69
  onlyMobile: PropTypes.bool,
69
70
  onlyDesktop: PropTypes.bool,
70
71
  initOpen: PropTypes.bool,
72
+ maxHeight: PropTypes.number,
71
73
  };
72
74
 
73
75
  export default Collapse;
@@ -8,20 +8,17 @@ const info = [
8
8
  {
9
9
  title: 'Fully licensed casinos',
10
10
  image: '../../../images/content-1.png',
11
- text:
12
- 'We only list and review fully licensed and legally operating casinos so you can be sure where you end up playing will be safe and secure.',
11
+ text: 'We only list and review fully licensed and legally operating casinos so you can be sure where you end up playing will be safe and secure.',
13
12
  },
14
13
  {
15
14
  title: 'Get the most for your money',
16
15
  image: '../../../images/content-2.png',
17
- text:
18
- 'We list all the features the Casinos have to offer so you can make an educated decision about where to place your money for maximum gains!',
16
+ text: 'We list all the features the Casinos have to offer so you can make an educated decision about where to place your money for maximum gains!',
19
17
  },
20
18
  {
21
19
  title: 'Authenticly written articles',
22
20
  image: '../../../images/content-3.png',
23
- text:
24
- 'All our Authors are professional writers with industry know-how, so you can depend on what we say is the truth!',
21
+ text: 'All our Authors are professional writers with industry know-how, so you can depend on what we say is the truth!',
25
22
  },
26
23
  ];
27
24
 
@@ -32,6 +29,12 @@ describe('ContentBox Component', () => {
32
29
  expect(getByText('Authenticly written articles')).toBeTruthy();
33
30
  expect(container.querySelectorAll('.icon')).toHaveLength(3);
34
31
  });
32
+
33
+ test('render without props', () => {
34
+ const { container } = render(<ContentBox data={[]} />);
35
+
36
+ expect(container.querySelector('li')).toBeFalsy();
37
+ });
35
38
  });
36
39
  afterEach(() => {
37
40
  cleanup();
@@ -8,19 +8,20 @@ import styles from './content-box.module.scss';
8
8
  const ContentBox = ({ data = [] }) => (
9
9
  <div className={styles.contentBoxContainer}>
10
10
  <ul className={styles.contentBoxList}>
11
- {data.map((item) => (
12
- <li key={keygen()}>
13
- <div className={styles.item}>
14
- <div className={styles.icon}>
15
- <LazyImage alt={item.title} src={item.image} />
11
+ {data &&
12
+ data.map((item) => (
13
+ <li key={keygen()}>
14
+ <div className={styles.item}>
15
+ <div className={styles.icon}>
16
+ <LazyImage alt={item.title} src={item.image} />
17
+ </div>
18
+ <div className={styles.body}>
19
+ <div className="h2">{item.title}</div>
20
+ <p>{item.text}</p>
21
+ </div>
16
22
  </div>
17
- <div className={styles.body}>
18
- <div className="h2">{item.title}</div>
19
- <p>{item.text}</p>
20
- </div>
21
- </div>
22
- </li>
23
- ))}
23
+ </li>
24
+ ))}
24
25
  </ul>
25
26
  </div>
26
27
  );
@@ -35,39 +35,40 @@ const CustomSelect = ({
35
35
  onClick={showDropdown}
36
36
  data-id="select-button"
37
37
  >
38
- {selectedOption[itemsLabel]}
38
+ {selectedOption && selectedOption[itemsLabel]}
39
39
  </button>
40
40
  <ol ref={selectList} className={styles.list} data-id="select-list">
41
- {options.map((item) => {
42
- if (item[itemsValue] === selectedOption[itemsValue]) return null;
43
- const currentItem = item;
44
- if (currentItem[itemsValue] === undefined) {
45
- currentItem[itemsValue] = 'id';
46
- }
47
- if (currentItem.type === undefined) {
48
- currentItem.type = 'type';
49
- }
50
- return (
51
- <li
52
- className={styles.selectListItem}
53
- key={keygen()}
54
- data-value={currentItem[itemsValue]}
55
- data-type={currentItem.type}
56
- >
57
- <button
58
- type="button"
59
- className="custom-select-gtm btn-cta"
60
- onClick={() => {
61
- onClick(currentItem[itemsValue], currentItem[itemsLabel], currentItem.type);
62
- setSelectedOption(currentItem);
63
- showDropdown();
64
- }}
41
+ {options &&
42
+ options.map((item) => {
43
+ if (item[itemsValue] === selectedOption[itemsValue]) return null;
44
+ const currentItem = item;
45
+ if (currentItem[itemsValue] === undefined) {
46
+ currentItem[itemsValue] = 'id';
47
+ }
48
+ if (currentItem.type === undefined) {
49
+ currentItem.type = 'type';
50
+ }
51
+ return (
52
+ <li
53
+ className={styles.selectListItem}
54
+ key={keygen()}
55
+ data-value={currentItem[itemsValue]}
56
+ data-type={currentItem.type}
65
57
  >
66
- {currentItem[itemsLabel]}
67
- </button>
68
- </li>
69
- );
70
- })}
58
+ <button
59
+ type="button"
60
+ className="custom-select-gtm btn-cta"
61
+ onClick={() => {
62
+ onClick(currentItem[itemsValue], currentItem[itemsLabel], currentItem.type);
63
+ setSelectedOption(currentItem);
64
+ showDropdown();
65
+ }}
66
+ >
67
+ {currentItem[itemsLabel]}
68
+ </button>
69
+ </li>
70
+ );
71
+ })}
71
72
  </ol>
72
73
  </div>
73
74
  );
@@ -1,5 +1,6 @@
1
+ /* eslint-disable no-unused-expressions */
1
2
  import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
3
+ import { render, cleanup, fireEvent } from '@testing-library/react';
3
4
 
4
5
  import '@testing-library/jest-dom/extend-expect';
5
6
 
@@ -17,6 +18,20 @@ describe('Disclaimer Component', () => {
17
18
  const { container } = render(<Disclaimer image={dmcaImg} />);
18
19
  expect(container.querySelectorAll('a')).toHaveLength(1);
19
20
  expect(container.querySelectorAll('img')).toHaveLength(1);
21
+ const ahref = container.querySelector('a');
22
+ // eslint-disable-next-line no-lone-blocks
23
+ {
24
+ ahref &&
25
+ fireEvent.change(ahref, {
26
+ target: {
27
+ href: '//www.dmca.com/Protection/Status.aspx?ID=9e466e76-827d-4247-ac51-4eb75b227301',
28
+ },
29
+ });
30
+ }
31
+ // eslint-disable-next-line no-lone-blocks
32
+ {
33
+ ahref && fireEvent.click(container.querySelector('a'));
34
+ }
20
35
  });
21
36
  });
22
37
  afterEach(() => {