gatsby-core-theme 3.0.0 → 5.0.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 (85) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/__mocks__/gatsby.js +16 -4
  3. package/gatsby-node.esm.js +7 -1
  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 +10 -11
  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/image/image.test.js +19 -6
  20. package/src/components/atoms/image/index.js +2 -4
  21. package/src/components/atoms/info-grid/index.js +10 -12
  22. package/src/components/atoms/label/index.js +2 -2
  23. package/src/components/atoms/label/label.test.js +4 -0
  24. package/src/components/atoms/module-title/index.js +9 -9
  25. package/src/components/atoms/module-title/module-title.test.js +76 -0
  26. package/src/components/atoms/open-graph/open-graph.test.js +34 -5
  27. package/src/components/atoms/operator-cta/operator-cta.test.js +26 -3
  28. package/src/components/atoms/scroll-to-top/scroll-to-top.test.js +6 -0
  29. package/src/components/atoms/search/autocomplete/operator.js +1 -1
  30. package/src/components/atoms/sitemap/index.js +1 -1
  31. package/src/components/atoms/spotlights/index.js +59 -54
  32. package/src/components/atoms/spotlights/spotlights.module.scss +25 -37
  33. package/src/components/atoms/spotlights/spotlights.test.js +13 -15
  34. package/src/components/molecules/carousel/default-slide/index.js +3 -1
  35. package/src/components/molecules/content/content.test.js +127 -0
  36. package/src/components/molecules/content/index.js +0 -1
  37. package/src/components/molecules/header/header.test.js +6 -0
  38. package/src/components/molecules/main/main.test.js +48 -12
  39. package/src/components/molecules/menu/menu.test.js +27 -0
  40. package/src/components/molecules/module/module.test.js +134 -0
  41. package/src/components/molecules/operator-banner/operator-banner.test.js +7 -1
  42. package/src/components/molecules/pagination/pagination-with-midpoints.module.scss +48 -49
  43. package/src/components/molecules/slider/index.js +6 -0
  44. package/src/components/organisms/anchor/index.js +14 -11
  45. package/src/components/organisms/carousel/index.js +16 -3
  46. package/src/components/organisms/cookie-consent/cookie-consent.test.js +7 -1
  47. package/src/components/organisms/form/form.test.js +21 -0
  48. package/src/components/organisms/form/index.js +5 -1
  49. package/src/components/organisms/navigation/index.js +9 -1
  50. package/src/components/organisms/search/index.js +0 -1
  51. package/src/components/organisms/toplist/list/index.js +1 -1
  52. package/src/components/organisms/toplist/list/list.test.js +30 -0
  53. package/src/components/pages/body/index.js +4 -6
  54. package/src/components/pages/tracker/index.js +1 -1
  55. package/src/constants/settings.js +1 -1
  56. package/src/helpers/getters.js +10 -6
  57. package/src/helpers/getters.test.js +1 -3
  58. package/src/helpers/processor/common.test.js +7 -1
  59. package/src/helpers/processor/index.js +2 -3
  60. package/src/helpers/processor/index.test.js +21 -0
  61. package/src/helpers/schema.js +14 -6
  62. package/src/helpers/schema.test.js +17 -14
  63. package/src/hooks/gatsby-img/index.js +1 -1
  64. package/src/hooks/lazy-image/index.js +37 -37
  65. package/src/hooks/lazy-image/lazy-image.test.js +39 -0
  66. package/src/hooks/lazy-picture/index.js +1 -1
  67. package/src/hooks/link/link.test.js +42 -1
  68. package/src/hooks/tabs/tab/tab.test.js +41 -0
  69. package/src/styles/utils/variables/_main.scss +3 -1
  70. package/tests/envVars.js +1 -1
  71. package/tests/factories/modules/content.factory.js +6 -3
  72. package/tests/factories/modules/modules.factory.js +152 -0
  73. package/tests/factories/modules/schema.factory.js +87 -0
  74. package/tests/factories/pages/list.factory.js +2 -1
  75. package/tests/factories/pages/pages.factory.js +192 -0
  76. package/tests/factories/sections/header.factory.js +8 -2
  77. package/src/components/atoms/logo/index.js +0 -36
  78. package/src/components/atoms/logo/logo.module.scss +0 -4
  79. package/src/components/atoms/logo/logo.stories.js +0 -57
  80. package/src/components/atoms/logo/logo.test.js +0 -30
  81. package/src/components/molecules/section/index.js +0 -24
  82. package/src/components/molecules/section/section.test.js +0 -16
  83. package/src/components/molecules/sidebar/index.js +0 -25
  84. package/src/components/molecules/sidebar/sidebar.module.scss +0 -3
  85. package/src/components/molecules/sidebar/sidebar.test.js +0 -30
package/CHANGELOG.md CHANGED
@@ -1,3 +1,119 @@
1
+ ## [5.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.0.0...v5.0.1) (2022-03-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * google bot images ([53fc90c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/53fc90c24cc7bacc9d5911fb05c29dae611fbc1f))
7
+ * lazy image tests ([ef63ea8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef63ea88cd2ff7b3dac335afd30e75e872cdff61))
8
+
9
+
10
+ * Merge branch 'tm-2743-googlebot-images' into 'master' ([2156666](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/21566661cd703480bb5e58bba9b2b6e1ecb49121))
11
+
12
+ # [5.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v4.0.0...v5.0.0) (2022-03-01)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * add slidetitle alt to images ([669ebdf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/669ebdf4f352558569ac5d122f1d790ae5f1a4e1))
18
+ * add src name as a title ([71afdbf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/71afdbf9a6c2de26022978aecc9313f1132981fa))
19
+ * add src name as a title ([4e4cae2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4e4cae288a80364c2d824673c08abb6cd7ea2738))
20
+ * added no script tag for all images even when using native lazy loading ([513dd8b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/513dd8b8501fbb0ea0a7e4210503826da942828a))
21
+ * author box alt tag ([7a1a76c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7a1a76c8ad1cbde35952e0eb12bcbbcce030cb47))
22
+ * fix html for anchor ([11518ca](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/11518caa9246edb373e2a6b590c2e6d371426d7e))
23
+ * schema fixes ([95f3adf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/95f3adf1ca366ed01184d5b93bcb7c721bf38177))
24
+ * schema fixes ([c684519](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c6845195c7b37f02cf09d795db27ccfd31f9c5bf))
25
+ * set interface of cssstyledeclaration on each render ([7c0060a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7c0060af75a13409a36ce67243f9afd92642a7f4))
26
+
27
+
28
+ ### Code Refactoring
29
+
30
+ * added image cdn urls ([1eeba30](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1eeba30c042b85ff0a814944484f33ad814dcb92))
31
+ * changes to image cdn url ([052df45](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/052df45ad2eb9e38c9b147b3477cd6b3f82ec505))
32
+ * changes to image cdn url ([c3eb17e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c3eb17e4f71e50aaacaf1eb5845d472ca9f188c2))
33
+ * create fileName getter fnc ([a1dc8ac](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a1dc8acbd40c362e73aafa19eecf7814ba9df17f))
34
+ * remove cross-env ([a12e65b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a12e65b4f7d5fc277103f860dd702195b1bda97c))
35
+ * remove test data ([657abde](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/657abdeef0ad948c64c1120e055db8d0a924106e))
36
+ * remove test data ([04649e6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/04649e649b2e1a4ca497f61e520bf2b1cc032f4f))
37
+
38
+
39
+ * Merge branch 'tm-2729-alt-tags' into 'master' ([f2776f2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f2776f2c31520822848b7b811df38405df26bef5))
40
+ * Merge branch 'tm-2743-noscript-tag' into 'master' ([26bc7d2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/26bc7d296af7175f31eac582d031b3bc7eb5fe6b))
41
+ * Merge branch 'tm-2740-carousel-fix' into 'master' ([a537f2f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a537f2f41d665e661e1486015f99ceb47d59fbce))
42
+ * Merge branch 'test-schema' into 'master' ([29641f7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/29641f7e2142ff0fb0a4b76f4201e758cf150aed))
43
+ * Merge branch 'tm-2706-custom-demo-deployment' into 'master' ([7383e0d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7383e0daddf51de0901dd4c441e6016c61d60224))
44
+ * Merge branch 'master' into tm-2706-custom-demo-deployment ([8a3d1ed](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8a3d1ed442250caa2be532138dba244b95cb1378))
45
+ * Merge branch 'tm-2721-fixhtml-anchor' into 'master' ([39a160c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/39a160cb88d7a352427e99a90fb4dc6655e9a877))
46
+
47
+
48
+ ### Tests
49
+
50
+ * schema changes ([c59116f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c59116f5d2122c97b2dd18e62b85358685cca277))
51
+ * temp test ([fb1bb3f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fb1bb3f44d07e2e8d96a8bdf4008e9d58c16e233))
52
+ * temp test ([11a0b99](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/11a0b99c235cabb9f11831c8647f2ba0aa0c7f31))
53
+ * temp test ([f81d84a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f81d84a3114d7ff4159a482e2db23dd8872c70ab))
54
+ * temp test ([03ab914](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/03ab914910aeb4180448f66f5abd09a92af087a5))
55
+ * temp test ([ec052c0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ec052c0dc395b8428e214db526c0000dcc8b2b68))
56
+ * temp test ([b2227b0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b2227b0170703795fce93e6d4ecfe6d1b8dd4446))
57
+
58
+ # [4.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v3.0.0...v4.0.0) (2022-02-21)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * add global variable for pagination border ([6046cad](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6046cad5a846f41220e3a6a7cbf5105c04d2f9a1))
64
+ * added custom styles ([9d4f51c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9d4f51cf96fba24b50b60dce92565c86b9f21334))
65
+ * fix conflicts ([b5fb9c6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b5fb9c6972488ece497a2d5b50a63d7799f63358))
66
+ * fix unit testing ([66f57d3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/66f57d3d4e8192eeb72f852d9834e0d58077a48a))
67
+ * fix unit testing ([88abd13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88abd1380c574cadd4c064580e458a862da71590))
68
+ * fix unit testing ([0497042](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0497042d8dc9aadae5f0d49e34ab8d1b3fa0663e))
69
+ * fixed prelive path condition ([b7bf68f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b7bf68fc29de038bf23988d0a16eca3ef5ef9f52))
70
+ * fixed unit testing ([8837446](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88374469c79e64b7e9f04a1ab3c18bc011adc99f))
71
+ * improve test for cookie and lazy ([7cc8a7d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7cc8a7da3bc8ffcaffb3b7326eecc0606c648f8c))
72
+ * improve unit testing ([0fbf8fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0fbf8fcd9e7a1df4d67bfc8e1b82eb433975850c))
73
+ * make unit testing ([7938019](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/793801915c7ccd835ca1976b83824416b86b8126))
74
+ * spotlight tests ([13f617c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/13f617c25ce7a2df84aec7acda9783c63890f59e))
75
+
76
+
77
+ ### Code Refactoring
78
+
79
+ * add variables to pipeline ([3c7b842](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3c7b8422769ffbc4196fc01770e2fd6df8f29923))
80
+ * changes to variables ([3b5a5a3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3b5a5a31a9de8430e611615b885c387b0f2551b9))
81
+ * cleaning up spotlights module ([9b8c181](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9b8c181311b0dbd5cee0748e239b6ea96c713dea))
82
+ * merge master to branch ([c4de93c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c4de93c2151a1f681bc7b93515c3e0e7ea606185))
83
+ * remove some unneeded components ([d29df5d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d29df5d0d112ed70fd56da3c5d749daf8e3c9008))
84
+ * remove test data ([8e3c0d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e3c0d60652e6a9f9b8541cccebc107c2d14a33d))
85
+ * remove unneeded check ([8007c96](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8007c967a82f5c216bc9196e35b67c1372e882a5))
86
+ * remove unused pipeline ([f4ba474](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f4ba474b9aa4bda20f1dae293888ee6869823023))
87
+ * test new pipeline ([afbda7c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/afbda7c3885959cebb2a3e1194dbad352b96a50d))
88
+ * test new pipeline ([74b1667](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/74b1667773a1bbf68e221dc9d990375b4efd61d1))
89
+ * test new pipeline ([0070134](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0070134d06fc8ef0ab8bb59dd82ff9a9a8bbf41f))
90
+ * test new pipeline ([8e4a07f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e4a07f910753d911b02b8e71d01f357ac98b3d0))
91
+ * test new pipeline ([918dede](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/918dede9f7bcac0dbc89d8a01797765732039b90))
92
+ * test new pipeline ([38f1572](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/38f15727f255602e46fad0deef41a80a07b2b5e8))
93
+ * update getPageImage conditionals for readability ([3026c02](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3026c02141ec1eb84e4347309571fa22fcf258c4))
94
+ * update img alt tags ([234ae5e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/234ae5eb892fc437197b79393508da69bc5b768e))
95
+ * update schema publisher logo check ([9cffb56](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9cffb5661157b3b7e8b549682b72628f4ce3aa04))
96
+ * update tracker pages pageImage generation ([6c6c86f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6c6c86f2eaab60d580f05d9a1c79e19ff1523adf))
97
+
98
+
99
+ ### Config
100
+
101
+ * increased threshold ([ef1c310](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef1c31023312841b11af983dab5a5a189124e06a))
102
+
103
+
104
+ * Merge branch 'tm-2624-spotlight-custom-styles' into 'master' ([18d168b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/18d168befd09fd279bc4a0e775f6a230df303fa0))
105
+ * Merge branch 'tm-2738-trackers-page-image' into 'master' ([cfc1fb4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cfc1fb413ca4350e2b9b73f72b58e688966eb108))
106
+ * Merge branch 'tm-2715-update-img-alt-tags' into 'master' ([fbbbad6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fbbbad60e6abc08cfc9c971519023177bbb61ad1))
107
+ * Merge branch 'master' into 'tm-2715-update-img-alt-tags' ([b27f85f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b27f85faeb6e843a0d12733635c1524239176b85))
108
+ * Merge branch 'tm-2716-html-cleanup' into 'master' ([83ff1de](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/83ff1de24d90207235833f43093c58edb519d0c4))
109
+ * Merge branch 'master' into 'tm-2715-update-img-alt-tags' ([ab98ebd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ab98ebd2ac7a220b4dcaa54ff87d68c1d23529c8))
110
+ * Merge branch 'tm-2706-custom-demo-deployment' into 'master' ([006e13d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/006e13d08f2bb435e99fb35f1bfec76f3f0c2590))
111
+ * Merge branch 'master' into tm-2706-custom-demo-deployment ([eb2483d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eb2483d76b494627555568ee2213ea7b8c6264a7))
112
+ * Merge branch 'tm-2699-unit-testing' into 'master' ([e36d06d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e36d06d8cd96bb92468047c319cb467ecdbd9980))
113
+ * Merge branch 'tm-2681-canary-tokens' into 'master' ([d70add6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d70add68ba2ba599f6e44d6686f108c68490168c))
114
+ * Merge branch 'tm-2705-gatsby-deployment-refactor' into 'master' ([d8dbeb2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8dbeb238502552d90e7092bca277a3f8873104a))
115
+ * Merge branch 'master' into tm-2705-gatsby-deployment-refactor ([2a11b10](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2a11b1015cf497661cc05ff3eb447921236fe0cc))
116
+
1
117
  # [3.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.6...v3.0.0) (2022-02-08)
2
118
 
3
119
 
@@ -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
+ };
@@ -270,6 +270,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
270
270
  component: require.resolve('./src/components/app.js'),
271
271
  context: {
272
272
  page: trackerPageObject,
273
+ siteInfo,
273
274
  provider,
274
275
  isTracker: true,
275
276
  },
@@ -299,7 +300,12 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
299
300
  createPage({
300
301
  path: trackerPath,
301
302
  component: require.resolve('./src/components/app.js'),
302
- context: { page: trackerPageObject, operator, isTracker: true },
303
+ context: {
304
+ page: trackerPageObject,
305
+ siteInfo,
306
+ operator,
307
+ isTracker: true,
308
+ },
303
309
  });
304
310
  }
305
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": "3.0.0",
3
+ "version": "5.0.1",
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,3 +1,4 @@
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';
@@ -15,21 +16,19 @@ export default function AuthorBox({ author }) {
15
16
  { id: 'li', link: author.linkedin_profile, icon: <FaLinkedin /> },
16
17
  { id: 'tw', link: author.twitter_profile, icon: <FaTwitter /> },
17
18
  ];
19
+
18
20
  return (
19
21
  <div className={styles.container}>
20
22
  <div className={styles.innerContainer}>
21
23
  <div className={styles.information}>
22
- <div>
23
- {' '}
24
- {author.image_object && (
25
- <LazyImage
26
- src={imagePrettyUrl(author.image_object.filename)}
27
- alt={author.image_alt}
28
- width={author.image_object?.width}
29
- height={author.image_object?.height}
30
- />
31
- )}
32
- </div>
24
+ {author.image_object && (
25
+ <LazyImage
26
+ src={imagePrettyUrl(author.image_object.filename)}
27
+ alt={author.image_alt || author.name}
28
+ width={author.image_object?.width}
29
+ height={author.image_object?.height}
30
+ />
31
+ )}
33
32
  <span className={styles.name}>{author.name}</span>
34
33
  <p className={styles.title}>{author.author_title}</p>
35
34
  </div>
@@ -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(() => {
@@ -0,0 +1,3 @@
1
+ .iframeContainer{
2
+ display: flex;
3
+ }
@@ -22,6 +22,12 @@ describe('Iframe Component', () => {
22
22
  expect(iframe.getAttribute('style')).toEqual('width: 100%; min-height: 10rem; display: block;');
23
23
  expect(iframe.getAttribute('src')).toEqual('http://google.com');
24
24
  });
25
+
26
+ test('without data', () => {
27
+ const { container } = render(<Iframe src="http://google.com" />);
28
+
29
+ expect(container.querySelector('iframe')).toBeFalsy();
30
+ });
25
31
  });
26
32
  afterEach(() => {
27
33
  cleanup();