@riosst100/pwa-marketplace 1.2.6 → 1.2.7

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 (129) hide show
  1. package/.github/workflows/dependabot.yml +28 -28
  2. package/package.json +18 -18
  3. package/src/Utilities/graphQL.js +76 -76
  4. package/src/componentOverrideMapping.js +17 -16
  5. package/src/components/BecomeSeller/becomeSeller.js +335 -335
  6. package/src/components/BecomeSeller/becomeSeller.module.css +46 -46
  7. package/src/components/BecomeSellerLink/becomeSellerLink.js +52 -52
  8. package/src/components/BecomeSellerLink/becomeSellerLink.module.css +12 -12
  9. package/src/components/BecomeSellerPage/becomeSellerPage.js +45 -45
  10. package/src/components/BecomeSellerPage/becomeSellerPage.module.css +21 -21
  11. package/src/components/Filter/index.js +53 -53
  12. package/src/components/Header/becomeSellerLink.js +28 -28
  13. package/src/components/Header/becomeSellerLink.module.css +12 -12
  14. package/src/components/Header/websiteSwitcher.js +109 -109
  15. package/src/components/Pagination/index.js +49 -40
  16. package/src/components/PhoneTextInput/phoneTextInput.module.css +21 -21
  17. package/src/components/ProductItem/index.js +50 -50
  18. package/src/components/Search/index.js +16 -16
  19. package/src/components/Seller/index.js +1 -1
  20. package/src/components/Seller/seller.js +249 -42
  21. package/src/components/SellerAccountPage/sellerAccountPage.js +110 -110
  22. package/src/components/SellerAccountPage/sellerAccountPage.module.css +55 -55
  23. package/src/components/SellerCountry/sellerCountry.gql.js +11 -11
  24. package/src/components/SellerInformation/index.js +1 -1
  25. package/src/components/SellerInformation/sellerInformation.js +90 -84
  26. package/src/components/SellerLocation/index.js +1 -1
  27. package/src/components/SellerLocation/sellerLocation.js +19 -18
  28. package/src/components/SellerLocation/sellerLocationItem.js +27 -25
  29. package/src/components/SellerPage/sellerPage.js +9 -9
  30. package/src/components/SellerProducts/sellerProducts.js +47 -218
  31. package/src/components/SellerReview/index.js +1 -1
  32. package/src/components/SellerReview/sellerReview.js +143 -143
  33. package/src/components/SellerReviewItem/sellerReviewItem.js +60 -60
  34. package/src/components/SellerVerification/sellerVerification.js +198 -198
  35. package/src/components/SellerVerification/sellerVerification.module.css +47 -47
  36. package/src/components/SellerVerificationPage/sellerVerificationPage.js +43 -43
  37. package/src/components/SellerVerificationPage/sellerVerificationPage.module.css +21 -21
  38. package/src/components/SortBy/index.js +24 -16
  39. package/src/components/WebsiteSwitcher/websiteSwitcher.js +109 -109
  40. package/src/components/commons/Slider/index.js +13 -13
  41. package/src/components/commons/Tabs/index.js +64 -62
  42. package/src/index.js +6 -6
  43. package/src/intercept.js +113 -113
  44. package/src/moduleOverrideWebpackPlugin.js +70 -70
  45. package/src/overwrites/peregrine/lib/store/actions/user/asyncActions.js +96 -96
  46. package/src/overwrites/peregrine/lib/talons/AccountMenu/useAccountMenuItems.js +74 -74
  47. package/src/overwrites/peregrine/lib/talons/Adapter/useAdapter.js +208 -208
  48. package/src/overwrites/peregrine/lib/talons/Header/storeSwitcher.gql.js +45 -45
  49. package/src/overwrites/peregrine/lib/talons/Header/useStoreSwitcher.js +204 -204
  50. package/src/overwrites/peregrine/lib/talons/Region/useRegion.js +102 -102
  51. package/src/overwrites/peregrine/lib/talons/SignIn/signIn.gql.js +56 -56
  52. package/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js +226 -226
  53. package/src/overwrites/peregrine/lib/util/deriveErrorMessage.js +34 -34
  54. package/src/overwrites/pwa-buildpack/lib/queries/getAvailableStoresConfigData.graphql +11 -11
  55. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +112 -112
  56. package/src/overwrites/venia-ui/lib/components/Header/header.js +130 -118
  57. package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +105 -105
  58. package/src/overwrites/venia-ui/lib/components/Header/switcherItem.js +47 -47
  59. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenu.spec.js +91 -91
  60. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenuItem.spec.js +123 -123
  61. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/Submenu.spec.js +61 -61
  62. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/SubmenuColumn.spec.js +50 -50
  63. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +114 -114
  64. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +71 -71
  65. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +59 -59
  66. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/SubmenuColumn.spec.js.snap +34 -34
  67. package/src/overwrites/venia-ui/lib/components/MegaMenu/index.js +1 -1
  68. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.js +90 -90
  69. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.module.css +12 -12
  70. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +156 -156
  71. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.module.css +30 -30
  72. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +89 -89
  73. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +42 -42
  74. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +99 -99
  75. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +28 -28
  76. package/src/overwrites/venia-ui/lib/components/SearchBar/__stories__/searchBar.js +11 -11
  77. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/searchField.spec.js.snap +72 -72
  78. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedCategories.spec.js.snap +30 -30
  79. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProduct.spec.js.snap +69 -69
  80. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProducts.spec.js.snap +7 -7
  81. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestions.spec.js.snap +12 -12
  82. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/autocomplete.spec.js +52 -52
  83. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchBar.spec.js +82 -82
  84. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchField.spec.js +87 -87
  85. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedCategories.spec.js +45 -45
  86. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProduct.spec.js +43 -43
  87. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProducts.spec.js +45 -45
  88. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestions.spec.js +110 -110
  89. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.js +172 -172
  90. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.module.css +62 -62
  91. package/src/overwrites/venia-ui/lib/components/SearchBar/index.js +1 -1
  92. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.js +74 -74
  93. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.module.css +49 -49
  94. package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +40 -40
  95. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.js +48 -48
  96. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.module.css +13 -13
  97. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategory.js +49 -49
  98. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.js +97 -97
  99. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.module.css +24 -24
  100. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.js +43 -43
  101. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.module.css +13 -13
  102. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.js +75 -75
  103. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.module.css +6 -6
  104. package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +75 -75
  105. package/src/overwrites/venia-ui/lib/targets/venia-ui-intercept.js +70 -70
  106. package/src/queries/getAvailableWebsitesConfigData.graphql +14 -14
  107. package/src/queries/index.js +30 -30
  108. package/src/talons/BecomeSeller/becomeSeller.gql.js +45 -45
  109. package/src/talons/BecomeSeller/useBecomeSeller.js +145 -145
  110. package/src/talons/BecomeSellerLink/useBecomeSellerLink.js +11 -11
  111. package/src/talons/BecomeSellerPage/useBecomeSellerPage.js +76 -76
  112. package/src/talons/Header/useBecomeSellerLink.js +13 -13
  113. package/src/talons/Header/useWebsiteSwitcher.js +218 -218
  114. package/src/talons/Seller/seller.gql.js +139 -204
  115. package/src/talons/Seller/useSeller.js +66 -71
  116. package/src/talons/SellerAccountPage/useSellerAccountPage.js +174 -174
  117. package/src/talons/SellerCountry/useSellerCountry.js +25 -25
  118. package/src/talons/WebsiteByIp/getWebsiteByIp.gql.js +13 -13
  119. package/src/talons/WebsiteByIp/useWebsiteByIp.js +34 -34
  120. package/src/talons/WebsiteSwitcher/useWebsiteSwitcher.js +218 -218
  121. package/src/theme/vars.js +6 -6
  122. package/src/util/mapSeller.js +7 -7
  123. package/src/components/OperatingHours/index.js +0 -1
  124. package/src/components/OperatingHours/operatingHours.js +0 -32
  125. package/src/components/Seller/sellerAddressCard.js +0 -48
  126. package/src/components/SellerDetail/index.js +0 -1
  127. package/src/components/SellerDetail/sellerDetail.js +0 -158
  128. package/src/components/SellerPage/core.js +0 -10
  129. package/src/talons/SellerProducts/useSellerProducts.js +0 -129
@@ -1,123 +1,123 @@
1
- import React from 'react';
2
- import { Link } from 'react-router-dom';
3
- import { act } from 'react-test-renderer';
4
-
5
- import { createTestInstance } from '@magento/peregrine';
6
-
7
- import MegaMenuItem from '../megaMenuItem';
8
-
9
- jest.mock('../../../classify');
10
- jest.mock('../../Icon', () => props => <mock-Icon {...props} />);
11
- jest.mock('../submenu', () => props => <mock-Submenu {...props} />);
12
- jest.mock('react', () => {
13
- const React = jest.requireActual('react');
14
- const memoSpy = jest.spyOn(React, 'useMemo');
15
-
16
- return Object.assign(React, {
17
- useMemo: memoSpy
18
- });
19
- });
20
-
21
- const mockHandleKeyDown = jest.fn();
22
-
23
- jest.mock('react-router-dom', () => ({
24
- Link: jest.fn(() => props => <mock-Link {...props} />)
25
- }));
26
-
27
- jest.mock('@magento/peregrine/lib/talons/MegaMenu/useMegaMenuItem', () => ({
28
- useMegaMenuItem: jest.fn(() => {
29
- return {
30
- isFocused: false,
31
- isActive: false,
32
- handleMenuItemFocus: jest.fn(),
33
- handleCloseSubMenu: jest.fn(),
34
- isMenuActive: false,
35
- handleKeyDown: mockHandleKeyDown
36
- };
37
- })
38
- }));
39
-
40
- let inputProps = {};
41
-
42
- const Component = () => {
43
- return <MegaMenuItem {...inputProps} />;
44
- };
45
-
46
- const givenDefaultValues = () => {
47
- inputProps = {
48
- activeCategoryId: 1,
49
- category: {
50
- id: 1,
51
- name: 'Women',
52
- url_path: 'women',
53
- isActive: true,
54
- children: [
55
- {
56
- id: 2,
57
- name: 'Bottoms',
58
- url_path: 'bottoms',
59
- children: []
60
- },
61
- {
62
- id: 3,
63
- name: 'Tops',
64
- url_path: 'tops',
65
- isActive: false,
66
- children: []
67
- }
68
- ]
69
- },
70
- rootCategoryName: 'Clothing',
71
- categoryUrlSuffix: '.html',
72
- mainNavWidth: 200,
73
- subMenuState: 'test',
74
- disableFocus: false
75
- };
76
- };
77
-
78
- describe('Mega menu item renders correctly', () => {
79
- beforeEach(() => {
80
- givenDefaultValues();
81
- });
82
-
83
- test('it renders correctly', () => {
84
- const instance = createTestInstance(<Component />);
85
-
86
- expect(instance.toJSON()).toMatchSnapshot();
87
- });
88
-
89
- test('it marks the active category', () => {
90
- const { root } = createTestInstance(<Component />);
91
-
92
- expect(root.findByType(Link).props.className).toEqual('megaMenuLink');
93
- expect(root.findByType(Link).props.to).toEqual('/women.html');
94
- expect(root.findByType(Link).props.children[0]).toEqual('Women');
95
- });
96
-
97
- it('should call a11yClick', () => {
98
- const { root } = createTestInstance(<Component />);
99
-
100
- act(() => {
101
- root.findByType(Link).props.onKeyDown();
102
- });
103
-
104
- expect(mockHandleKeyDown).toHaveBeenCalled();
105
- });
106
-
107
- test('it does not render submenu when item does not have children', () => {
108
- const categoryWithoutChildren = {
109
- id: 3,
110
- name: 'Tops',
111
- url_path: 'tops',
112
- isActive: false,
113
- children: []
114
- };
115
-
116
- const instance = createTestInstance(
117
- <Component category={categoryWithoutChildren} />
118
- );
119
-
120
- expect(instance.toJSON().children.length).toEqual(1);
121
- expect(instance.toJSON()).toMatchSnapshot();
122
- });
123
- });
1
+ import React from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import { act } from 'react-test-renderer';
4
+
5
+ import { createTestInstance } from '@magento/peregrine';
6
+
7
+ import MegaMenuItem from '../megaMenuItem';
8
+
9
+ jest.mock('../../../classify');
10
+ jest.mock('../../Icon', () => props => <mock-Icon {...props} />);
11
+ jest.mock('../submenu', () => props => <mock-Submenu {...props} />);
12
+ jest.mock('react', () => {
13
+ const React = jest.requireActual('react');
14
+ const memoSpy = jest.spyOn(React, 'useMemo');
15
+
16
+ return Object.assign(React, {
17
+ useMemo: memoSpy
18
+ });
19
+ });
20
+
21
+ const mockHandleKeyDown = jest.fn();
22
+
23
+ jest.mock('react-router-dom', () => ({
24
+ Link: jest.fn(() => props => <mock-Link {...props} />)
25
+ }));
26
+
27
+ jest.mock('@magento/peregrine/lib/talons/MegaMenu/useMegaMenuItem', () => ({
28
+ useMegaMenuItem: jest.fn(() => {
29
+ return {
30
+ isFocused: false,
31
+ isActive: false,
32
+ handleMenuItemFocus: jest.fn(),
33
+ handleCloseSubMenu: jest.fn(),
34
+ isMenuActive: false,
35
+ handleKeyDown: mockHandleKeyDown
36
+ };
37
+ })
38
+ }));
39
+
40
+ let inputProps = {};
41
+
42
+ const Component = () => {
43
+ return <MegaMenuItem {...inputProps} />;
44
+ };
45
+
46
+ const givenDefaultValues = () => {
47
+ inputProps = {
48
+ activeCategoryId: 1,
49
+ category: {
50
+ id: 1,
51
+ name: 'Women',
52
+ url_path: 'women',
53
+ isActive: true,
54
+ children: [
55
+ {
56
+ id: 2,
57
+ name: 'Bottoms',
58
+ url_path: 'bottoms',
59
+ children: []
60
+ },
61
+ {
62
+ id: 3,
63
+ name: 'Tops',
64
+ url_path: 'tops',
65
+ isActive: false,
66
+ children: []
67
+ }
68
+ ]
69
+ },
70
+ rootCategoryName: 'Clothing',
71
+ categoryUrlSuffix: '.html',
72
+ mainNavWidth: 200,
73
+ subMenuState: 'test',
74
+ disableFocus: false
75
+ };
76
+ };
77
+
78
+ describe('Mega menu item renders correctly', () => {
79
+ beforeEach(() => {
80
+ givenDefaultValues();
81
+ });
82
+
83
+ test('it renders correctly', () => {
84
+ const instance = createTestInstance(<Component />);
85
+
86
+ expect(instance.toJSON()).toMatchSnapshot();
87
+ });
88
+
89
+ test('it marks the active category', () => {
90
+ const { root } = createTestInstance(<Component />);
91
+
92
+ expect(root.findByType(Link).props.className).toEqual('megaMenuLink');
93
+ expect(root.findByType(Link).props.to).toEqual('/women.html');
94
+ expect(root.findByType(Link).props.children[0]).toEqual('Women');
95
+ });
96
+
97
+ it('should call a11yClick', () => {
98
+ const { root } = createTestInstance(<Component />);
99
+
100
+ act(() => {
101
+ root.findByType(Link).props.onKeyDown();
102
+ });
103
+
104
+ expect(mockHandleKeyDown).toHaveBeenCalled();
105
+ });
106
+
107
+ test('it does not render submenu when item does not have children', () => {
108
+ const categoryWithoutChildren = {
109
+ id: 3,
110
+ name: 'Tops',
111
+ url_path: 'tops',
112
+ isActive: false,
113
+ children: []
114
+ };
115
+
116
+ const instance = createTestInstance(
117
+ <Component category={categoryWithoutChildren} />
118
+ );
119
+
120
+ expect(instance.toJSON().children.length).toEqual(1);
121
+ expect(instance.toJSON()).toMatchSnapshot();
122
+ });
123
+ });
@@ -1,61 +1,61 @@
1
- import React from 'react';
2
- import { createTestInstance } from '@magento/peregrine';
3
- import { MemoryRouter } from 'react-router-dom';
4
-
5
- import Submenu from '../submenu';
6
-
7
- jest.mock('../../../classify');
8
- jest.mock('../submenuColumn', () => props => <mock-SubmenuColumn {...props} />);
9
- jest.mock('react', () => {
10
- const React = jest.requireActual('react');
11
- const callbackSpy = jest.spyOn(React, 'useCallback');
12
-
13
- return Object.assign(React, {
14
- callbackSpy: callbackSpy
15
- });
16
- });
17
-
18
- const handleCloseSubMenu = jest.fn().mockName('handleCloseSubMenu');
19
-
20
- describe('Submenu renders correctly', () => {
21
- const props = {
22
- items: [
23
- {
24
- id: 1,
25
- name: 'Bottoms',
26
- url_path: 'bottoms',
27
- children: [
28
- {
29
- id: 3,
30
- name: 'Pants',
31
- url_path: 'pants',
32
- isActive: false,
33
- children: []
34
- }
35
- ]
36
- },
37
- {
38
- id: 2,
39
- name: 'Tops',
40
- url_path: 'tops',
41
- isActive: false,
42
- children: []
43
- }
44
- ],
45
- rootCategoryName: 'Clothing',
46
- firstLevelCategoryName: 'Women',
47
- categoryUrlSuffix: '.html',
48
- handleCloseSubMenu,
49
- isFocused: false,
50
- subMenuState: false
51
- };
52
- test('it renders correctly', () => {
53
- const instance = createTestInstance(
54
- <MemoryRouter>
55
- <Submenu {...props} />
56
- </MemoryRouter>
57
- );
58
-
59
- expect(instance.toJSON()).toMatchSnapshot();
60
- });
61
- });
1
+ import React from 'react';
2
+ import { createTestInstance } from '@magento/peregrine';
3
+ import { MemoryRouter } from 'react-router-dom';
4
+
5
+ import Submenu from '../submenu';
6
+
7
+ jest.mock('../../../classify');
8
+ jest.mock('../submenuColumn', () => props => <mock-SubmenuColumn {...props} />);
9
+ jest.mock('react', () => {
10
+ const React = jest.requireActual('react');
11
+ const callbackSpy = jest.spyOn(React, 'useCallback');
12
+
13
+ return Object.assign(React, {
14
+ callbackSpy: callbackSpy
15
+ });
16
+ });
17
+
18
+ const handleCloseSubMenu = jest.fn().mockName('handleCloseSubMenu');
19
+
20
+ describe('Submenu renders correctly', () => {
21
+ const props = {
22
+ items: [
23
+ {
24
+ id: 1,
25
+ name: 'Bottoms',
26
+ url_path: 'bottoms',
27
+ children: [
28
+ {
29
+ id: 3,
30
+ name: 'Pants',
31
+ url_path: 'pants',
32
+ isActive: false,
33
+ children: []
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ id: 2,
39
+ name: 'Tops',
40
+ url_path: 'tops',
41
+ isActive: false,
42
+ children: []
43
+ }
44
+ ],
45
+ rootCategoryName: 'Clothing',
46
+ firstLevelCategoryName: 'Women',
47
+ categoryUrlSuffix: '.html',
48
+ handleCloseSubMenu,
49
+ isFocused: false,
50
+ subMenuState: false
51
+ };
52
+ test('it renders correctly', () => {
53
+ const instance = createTestInstance(
54
+ <MemoryRouter>
55
+ <Submenu {...props} />
56
+ </MemoryRouter>
57
+ );
58
+
59
+ expect(instance.toJSON()).toMatchSnapshot();
60
+ });
61
+ });
@@ -1,50 +1,50 @@
1
- import React from 'react';
2
- import { createTestInstance } from '@magento/peregrine';
3
- import { MemoryRouter } from 'react-router-dom';
4
-
5
- import SubmenuColumn from '../submenuColumn';
6
-
7
- jest.mock('../../../classify');
8
-
9
- describe('Submenu column renders correctly', () => {
10
- const props = {
11
- category: {
12
- id: 1,
13
- name: 'Pants',
14
- url_path: 'pants',
15
- children: [
16
- {
17
- id: 2,
18
- name: 'Jeans',
19
- url_path: 'jeans',
20
- isActive: true,
21
- children: []
22
- }
23
- ]
24
- },
25
- categoryUrlSuffix: '.html'
26
- };
27
-
28
- test('it renders correctly', () => {
29
- const instance = createTestInstance(
30
- <MemoryRouter>
31
- <SubmenuColumn {...props} />
32
- </MemoryRouter>
33
- );
34
-
35
- expect(instance.toJSON()).toMatchSnapshot();
36
- });
37
-
38
- test('it renders active state', () => {
39
- const instance = createTestInstance(
40
- <MemoryRouter>
41
- <SubmenuColumn {...props} />
42
- </MemoryRouter>
43
- );
44
-
45
- const activeLink = instance.root.findByProps({
46
- className: 'linkActive'
47
- });
48
- expect(activeLink.props.children).toEqual('Jeans');
49
- });
50
- });
1
+ import React from 'react';
2
+ import { createTestInstance } from '@magento/peregrine';
3
+ import { MemoryRouter } from 'react-router-dom';
4
+
5
+ import SubmenuColumn from '../submenuColumn';
6
+
7
+ jest.mock('../../../classify');
8
+
9
+ describe('Submenu column renders correctly', () => {
10
+ const props = {
11
+ category: {
12
+ id: 1,
13
+ name: 'Pants',
14
+ url_path: 'pants',
15
+ children: [
16
+ {
17
+ id: 2,
18
+ name: 'Jeans',
19
+ url_path: 'jeans',
20
+ isActive: true,
21
+ children: []
22
+ }
23
+ ]
24
+ },
25
+ categoryUrlSuffix: '.html'
26
+ };
27
+
28
+ test('it renders correctly', () => {
29
+ const instance = createTestInstance(
30
+ <MemoryRouter>
31
+ <SubmenuColumn {...props} />
32
+ </MemoryRouter>
33
+ );
34
+
35
+ expect(instance.toJSON()).toMatchSnapshot();
36
+ });
37
+
38
+ test('it renders active state', () => {
39
+ const instance = createTestInstance(
40
+ <MemoryRouter>
41
+ <SubmenuColumn {...props} />
42
+ </MemoryRouter>
43
+ );
44
+
45
+ const activeLink = instance.root.findByProps({
46
+ className: 'linkActive'
47
+ });
48
+ expect(activeLink.props.children).toEqual('Jeans');
49
+ });
50
+ });