@licklist/design 0.58.5 → 0.58.6-dev.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 (169) hide show
  1. package/bitbucket-pipelines.yml +0 -8
  2. package/dist/iframe/event/event-card/IframeEventCard.d.ts +2 -1
  3. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  4. package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
  5. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
  6. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
  7. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
  8. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/product-set/card/ProductSetCard.d.ts +2 -1
  11. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  12. package/dist/product-set/card/ProductSetCard.js +1 -1
  13. package/dist/product-set/control/DateInput.d.ts +17 -0
  14. package/dist/product-set/control/DateInput.d.ts.map +1 -0
  15. package/dist/product-set/control/DateInput.js +1 -0
  16. package/dist/product-set/control/ProductSetControl.d.ts +2 -1
  17. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  18. package/dist/product-set/control/ProductSetControl.js +1 -1
  19. package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts +11 -0
  20. package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts.map +1 -0
  21. package/dist/product-set/control/ProductSetRecurrenceOverridesControl.js +1 -0
  22. package/dist/product-set/control/TutorialGifCard.d.ts +2 -1
  23. package/dist/product-set/control/TutorialGifCard.d.ts.map +1 -1
  24. package/dist/product-set/control/TutorialGifCard.js +1 -1
  25. package/dist/product-set/form/ProductCategoriesControl.d.ts +2 -1
  26. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  27. package/dist/product-set/form/ProductCategoriesControl.js +1 -1
  28. package/dist/product-set/form/ProductSetForm.d.ts +7 -2
  29. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  30. package/dist/product-set/form/ProductSetForm.js +1 -1
  31. package/dist/product-set/form/ProductsControl.d.ts +2 -1
  32. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  33. package/dist/product-set/form/ProductsControl.js +1 -1
  34. package/dist/product-set/form/StepsControl.d.ts +2 -1
  35. package/dist/product-set/form/StepsControl.d.ts.map +1 -1
  36. package/dist/product-set/form/StepsControl.js +1 -1
  37. package/dist/product-set/form/SubProductsControl.d.ts +2 -1
  38. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  39. package/dist/product-set/form/SubProductsControl.js +1 -1
  40. package/dist/product-set/hooks/useSortableTreeFunctions.d.ts +2 -1
  41. package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
  42. package/dist/product-set/hooks/useSortableTreeFunctions.js +1 -1
  43. package/dist/product-set/item/CreateProductSetItem.d.ts +2 -1
  44. package/dist/product-set/item/CreateProductSetItem.d.ts.map +1 -1
  45. package/dist/product-set/item/CreateProductSetItem.js +1 -1
  46. package/dist/product-set/product/ProductControl.d.ts +2 -1
  47. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  48. package/dist/product-set/product/ProductControl.js +1 -1
  49. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts +4 -2
  50. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
  51. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.js +1 -1
  52. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts +1 -0
  53. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
  54. package/dist/product-set/product/quantity/ProductQuantityControl.js +1 -1
  55. package/dist/product-set/product-category/ProductCategoryControl.d.ts +2 -1
  56. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  57. package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
  58. package/dist/recurring-date-picker-input/DatePickerInput.d.ts +19 -0
  59. package/dist/recurring-date-picker-input/DatePickerInput.d.ts.map +1 -0
  60. package/dist/recurring-date-picker-input/DatePickerInput.js +1 -0
  61. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts +15 -0
  62. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -0
  63. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.js +1 -0
  64. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +2 -0
  65. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  66. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  67. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  68. package/dist/sales/booking/results/components/ResultCard.js +1 -1
  69. package/dist/sortable-list/SortableList.d.ts +2 -1
  70. package/dist/sortable-list/SortableList.d.ts.map +1 -1
  71. package/dist/sortable-list/SortableList.js +1 -1
  72. package/dist/sortable-tree/SortableTreeItem.d.ts +3 -1
  73. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  74. package/dist/sortable-tree/SortableTreeItem.js +1 -1
  75. package/dist/static/manual-date-picker/ManualDatePicker.js +1 -1
  76. package/dist/static/manual-date-picker/constants/index.d.ts +4 -1
  77. package/dist/static/manual-date-picker/constants/index.d.ts.map +1 -1
  78. package/dist/static/manual-date-picker/constants/index.js +1 -1
  79. package/dist/static/manual-date-picker/utils/index.d.ts +4 -0
  80. package/dist/static/manual-date-picker/utils/index.d.ts.map +1 -1
  81. package/dist/static/manual-date-picker/utils/index.js +1 -1
  82. package/dist/styles/availability-indicator/AvailabilityIndicator.scss +10 -0
  83. package/dist/styles/iframe-events/Card.scss +24 -8
  84. package/dist/styles/iframe-events/PoweredBy.scss +2 -2
  85. package/dist/styles/iframe-order-process/IframeOrderProcess.scss +0 -2
  86. package/dist/styles/iframe-page/Page.scss +1 -0
  87. package/dist/styles/iframe-page/PageBody.scss +32 -11
  88. package/dist/styles/iframe-page/PageHeader.scss +41 -39
  89. package/dist/styles/product-set/EditVenueMapSetModal.scss +1 -1
  90. package/dist/styles/sales/BookingResults.scss +1 -1
  91. package/package.json +10 -33
  92. package/src/calendar/Calendar.stories.tsx +9 -2
  93. package/src/iframe/event/event-card/IframeEventCard.stories.tsx +1 -0
  94. package/src/iframe/event/event-card/IframeEventCard.tsx +7 -8
  95. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
  96. package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +3 -1
  97. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
  98. package/src/product-set/card/ProductSetCard.tsx +10 -1
  99. package/src/product-set/control/DateInput.tsx +309 -0
  100. package/src/product-set/control/ProductSetControl.tsx +46 -24
  101. package/src/product-set/control/ProductSetRecurrenceOverridesControl.tsx +63 -0
  102. package/src/product-set/control/TutorialGifCard.tsx +11 -3
  103. package/src/product-set/form/ProductCategoriesControl.tsx +12 -1
  104. package/src/product-set/form/ProductSetForm.tsx +10 -1
  105. package/src/product-set/form/ProductsControl.tsx +10 -0
  106. package/src/product-set/form/StepsControl.tsx +8 -2
  107. package/src/product-set/form/SubProductsControl.tsx +3 -0
  108. package/src/product-set/hooks/useSortableTreeFunctions.ts +6 -0
  109. package/src/product-set/item/CreateProductSetItem.tsx +3 -0
  110. package/src/product-set/product/ProductControl.tsx +23 -12
  111. package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +8 -2
  112. package/src/product-set/product/quantity/ProductQuantityControl.tsx +4 -3
  113. package/src/product-set/product-category/ProductCategoryControl.tsx +12 -8
  114. package/src/recurring-date-picker-input/DatePickerInput.tsx +93 -0
  115. package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +136 -0
  116. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +4 -1
  117. package/src/sales/booking/results/BookingResults.stories.tsx +3 -2
  118. package/src/sales/booking/results/components/ResultCard.tsx +2 -5
  119. package/src/sortable-list/SortableList.tsx +3 -0
  120. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  121. package/src/static/manual-date-picker/ManualDatePicker.tsx +3 -3
  122. package/src/static/manual-date-picker/constants/index.ts +6 -2
  123. package/src/static/manual-date-picker/utils/index.ts +11 -0
  124. package/src/static/switch/BooleanSwitch.tsx +1 -1
  125. package/src/styles/availability-indicator/AvailabilityIndicator.scss +10 -0
  126. package/src/styles/iframe-events/Card.scss +24 -8
  127. package/src/styles/iframe-events/PoweredBy.scss +2 -2
  128. package/src/styles/iframe-order-process/IframeOrderProcess.scss +0 -2
  129. package/src/styles/iframe-page/Page.scss +1 -0
  130. package/src/styles/iframe-page/PageBody.scss +32 -11
  131. package/src/styles/iframe-page/PageHeader.scss +41 -39
  132. package/src/styles/product-set/EditVenueMapSetModal.scss +1 -1
  133. package/src/styles/sales/BookingResults.scss +1 -1
  134. package/jest.config.js +0 -29
  135. package/tests/Auth/Authorizer.test.tsx +0 -194
  136. package/tests/Auth/Layout/UserNavDropDown.test.tsx +0 -43
  137. package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +0 -33
  138. package/tests/Auth/Login/LoginComponent.test.tsx +0 -246
  139. package/tests/Auth/Login/LoginFormComponent.test.tsx +0 -182
  140. package/tests/Auth/Register/RegisterComponent.test.tsx +0 -285
  141. package/tests/Auth/Register/RegisterFormComponent.test.tsx +0 -170
  142. package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +0 -130
  143. package/tests/Auth/Social/SocialCallbackComponent.test.tsx +0 -133
  144. package/tests/Auth/Social/SocialFormComponent.test.tsx +0 -118
  145. package/tests/FileUpload/FileUpload.test.tsx +0 -42
  146. package/tests/Notification/EmailTemplate.test.tsx +0 -82
  147. package/tests/ProductSet/ProductSetPopover.test.tsx +0 -40
  148. package/tests/Report/Report.test.tsx +0 -48
  149. package/tests/Sales/Coupon.test.tsx +0 -51
  150. package/tests/Sales/SalesAndVIews.test.tsx +0 -63
  151. package/tests/SnippetTemplates/SnippetTemplates.test.tsx +0 -56
  152. package/tests/Table/FilterHelperComponent.test.tsx +0 -88
  153. package/tests/Table/PaginationHelperComponent.test.tsx +0 -109
  154. package/tests/Table/PerPageHelperComponent.test.tsx +0 -34
  155. package/tests/Table/TableHelperComponent.test.tsx +0 -295
  156. package/tests/TipTapEditor/TipTapEditor.test.tsx +0 -28
  157. package/tests/__mock__/hooks/useAuthApi.ts +0 -13
  158. package/tests/__mock__/hooks/useAuthMock.ts +0 -13
  159. package/tests/__mock__/hooks/useFormMock.ts +0 -27
  160. package/tests/__mock__/hooks/useNotificationMock.ts +0 -13
  161. package/tests/__mock__/hooks/useQueryMock.ts +0 -16
  162. package/tests/__mock__/hooks/useSocialApiMock.ts +0 -20
  163. package/tests/__mock__/hooks/useTranslationMock.ts +0 -17
  164. package/tests/__mock__/hooks/useUserApiMock.ts +0 -18
  165. package/tests/__mock__/hooks/useUserMock.ts +0 -13
  166. package/tests/__mock__/styleMock.js +0 -1
  167. package/tests/__mock__/windowMock.ts +0 -5
  168. package/tests/packages/react-query.tsx +0 -28
  169. package/tests/setupTests.ts +0 -10
@@ -12,9 +12,6 @@
12
12
  .left-block {
13
13
  flex: 1;
14
14
  align-items: stretch;
15
- border-radius: 0.5rem;
16
- border-bottom-left-radius: 0;
17
- border-bottom-right-radius: 0;
18
15
  padding: 1rem;
19
16
  background-color: $snippet-page-body-left-block-background-color;
20
17
  border: 0;
@@ -33,7 +30,6 @@
33
30
  display: flex;
34
31
  align-items: flex-start;
35
32
  justify-content: space-between;
36
-
37
33
  .title {
38
34
  color: $snippet-elements-body-color;
39
35
  margin: 0;
@@ -64,7 +60,7 @@
64
60
  overflow-x: hidden;
65
61
  scrollbar-width: thin;
66
62
  .iframe-event-card {
67
- border-bottom: 2px solid $separator-color;
63
+ border-bottom: 1px solid $separator-color;
68
64
  }
69
65
 
70
66
  @include media-breakpoint-down(sm) {
@@ -81,8 +77,6 @@
81
77
  }
82
78
 
83
79
  .right-block {
84
- margin-left: 1rem;
85
- border-radius: 0.5rem;
86
80
  height: calc(100% - 1rem);
87
81
  max-width: 17.5rem;
88
82
  min-width: 17.5rem;
@@ -115,7 +109,7 @@
115
109
  }
116
110
 
117
111
  .collapse {
118
- max-height: calc(100vh - 19rem);
112
+ max-height: calc(100vh - 15rem);
119
113
  transition: none 0s ease 0s;
120
114
 
121
115
  &.show {
@@ -125,7 +119,7 @@
125
119
  }
126
120
 
127
121
  @include media-breakpoint-down(sm) {
128
- max-height: 7.5rem;
122
+ max-height: 100%;
129
123
  }
130
124
  }
131
125
  .collapse-with-people-input {
@@ -151,8 +145,14 @@
151
145
  }
152
146
 
153
147
  .iframe-event-card {
154
- background-color: transparent;
155
- border-color: transparent;
148
+ border: none;
149
+
150
+ .card-image {
151
+ border-radius: 0;
152
+ }
153
+ .card-body {
154
+ padding-left: 1rem;
155
+ }
156
156
  }
157
157
 
158
158
  .price {
@@ -262,3 +262,24 @@
262
262
  }
263
263
  }
264
264
  }
265
+
266
+ .event-list-page-body {
267
+ overflow: auto;
268
+ .left-block {
269
+ .navigation {
270
+ font-size: 1.125rem;
271
+ font-weight: 500;
272
+ padding-bottom: 2.625rem;
273
+ display: flex;
274
+ align-items: flex-start;
275
+ justify-content: space-between;
276
+ margin-top: 0.125rem;
277
+
278
+ .title {
279
+ position: absolute;
280
+ color: $snippet-elements-body-color;
281
+ margin: 0;
282
+ }
283
+ }
284
+ }
285
+ }
@@ -20,55 +20,57 @@ $base-height: 2.5rem;
20
20
  transition: $color-transition;
21
21
  border: 0;
22
22
  }
23
+ }
24
+ }
23
25
 
24
- .button-wrapper {
25
- background-color: $snippet-page-header-steps-close-button-background-color;
26
- height: $base-height;
26
+ .iframe-page {
27
+ .button-wrapper {
28
+ background-color: $snippet-page-header-steps-close-button-background-color;
29
+ height: $base-height;
30
+ width: $base-height;
31
+ border-radius: $base-height;
32
+ transition: $color-transition;
33
+
34
+ .close-button {
35
+ font-size: 1.25rem;
27
36
  width: $base-height;
28
- border-radius: $base-height;
37
+ height: $base-height;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ color: $snippet-page-header-steps-close-button-border-color;
29
42
  transition: $color-transition;
30
43
 
31
- .close-button {
32
- font-size: 1.25rem;
33
- width: $base-height;
34
- height: $base-height;
35
- display: flex;
36
- align-items: center;
37
- justify-content: center;
38
- color: $snippet-page-header-steps-close-button-border-color;
39
- transition: $color-transition;
40
-
41
- &:hover {
42
- cursor: pointer;
43
- }
44
+ &:hover {
45
+ cursor: pointer;
44
46
  }
47
+ }
45
48
 
46
- &.close-button {
47
- margin-left: 1rem;
48
- }
49
+ &.close-button {
50
+ margin-left: 1rem;
51
+ }
49
52
 
50
- .back-button {
51
- font-size: 2rem;
52
- width: $base-height;
53
- height: $base-height;
54
- display: flex;
55
- align-items: center;
56
- justify-content: center;
57
- font-weight: lighter;
58
- color: $snippet-page-header-steps-close-button-border-color;
59
- transition: $color-transition;
53
+ .back-button {
54
+ font-size: 2rem;
55
+ width: $base-height;
56
+ height: $base-height;
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ font-weight: lighter;
61
+ color: $snippet-page-header-steps-close-button-border-color;
62
+ transition: $color-transition;
60
63
 
61
- &:hover {
62
- cursor: pointer;
63
- }
64
+ &:hover {
65
+ cursor: pointer;
64
66
  }
67
+ }
65
68
 
66
- &.back-button {
67
- display: flex;
68
- align-items: center;
69
- justify-content: center;
70
- margin-right: 1rem;
71
- }
69
+ &.back-button {
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ margin-right: 1rem;
72
74
  }
73
75
  }
74
76
  }
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  @include media-breakpoint-down(sm) {
94
- top: 50%;
94
+ top: 100%;
95
95
 
96
96
  .step-save-btn {
97
97
  width: 100%;
@@ -5,7 +5,7 @@
5
5
  flex-wrap: wrap;
6
6
 
7
7
  .result-card {
8
- height: 14.25rem;
8
+ height: 14rem;
9
9
  border: 1px solid $gray-400;
10
10
  max-width: calc(50% - 0.75rem);
11
11
  flex: 0 0 calc(50% - 0.75rem);
package/jest.config.js DELETED
@@ -1,29 +0,0 @@
1
- // For a detailed explanation regarding each configuration property, visit:
2
- // https://jestjs.io/docs/en/configuration.html
3
-
4
- module.exports = {
5
- modulePathIgnorePatterns: ["/dist/"],
6
- roots: ["<rootDir>/src", "<rootDir>/tests"],
7
- globals: {
8
- "ts-jest": {
9
- isolatedModules: true,
10
- babelConfig: {
11
- presets: ["@babel/preset-env", "@babel/preset-react"],
12
- },
13
- },
14
- },
15
- transform: {
16
- "^.+\\.(t|j)sx?$": "ts-jest",
17
- },
18
- transformIgnorePatterns: [
19
- "node_modules/(?!(redux-persist)/)",
20
- "node_modules/(?!(@licklist)/)",
21
- ],
22
- testRegex: ["(\\/tests\\/.*.(test|spec))\\.tsx?$"],
23
- moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
24
- setupFilesAfterEnv: ["<rootDir>/tests/setupTests.ts"],
25
- moduleNameMapper: {
26
- "^.+\\.(css|scss|sass|less)$": "<rootDir>/tests/__mock__/styleMock.js",
27
- ".+\\.(svg|png|jpg)$": "identity-obj-proxy",
28
- },
29
- };
@@ -1,194 +0,0 @@
1
- import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
2
- import { mount, shallow } from "enzyme";
3
- import * as React from "react";
4
- import { act } from "react-dom/test-utils";
5
- import { QueryClientProvider } from "react-query";
6
- import { Authorizer } from "../../src/auth/Authorizer";
7
- import useAuthMock from "../__mock__/hooks/useAuthMock";
8
- import useUserMock from "../__mock__/hooks/useUserMock";
9
- import useAuthApi from "../__mock__/hooks/useAuthApi";
10
- import { queryClient } from "../packages/react-query";
11
-
12
- jest.mock("react-i18next", () => ({
13
- Trans: jest.fn().mockReturnValue("test"),
14
- useTranslation: () => ({
15
- t: jest.fn((arg) => arg),
16
- }),
17
- }));
18
- jest.mock("@licklist/plugins/dist/context/user/hooks/useAuth");
19
- jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
20
- jest.mock("@licklist/plugins/dist/hooks/Api/useAuthApi");
21
-
22
- const DEFAULT_PROFILE_RESPONSE = {
23
- useProfile: () => ({
24
- isLoading: false,
25
- isFetching: false,
26
- isError: false,
27
- data: { access_token: "test" },
28
- }),
29
- };
30
-
31
- const DEFAULT_PROFILE_LOADING_RESPONSE = {
32
- useProfile: () => ({
33
- isLoading: true,
34
- isFetching: false,
35
- isError: false,
36
- data: { access_token: "test" },
37
- }),
38
- };
39
-
40
- describe("Authorizer", () => {
41
- it("should be rendered without issues", () => {
42
- useAuthMock({
43
- secrets: null,
44
- });
45
- useUserMock({
46
- profile: null,
47
- });
48
- useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
49
-
50
- const component = shallow(
51
- <QueryClientProvider client={queryClient}>
52
- <Authorizer />
53
- </QueryClientProvider>
54
- );
55
-
56
- expect(component.exists()).toBeTruthy();
57
- });
58
-
59
- it("should render children if authorized", () => {
60
- let component: any;
61
-
62
- useAuthMock({
63
- secrets: "not-null",
64
- });
65
- useUserMock({
66
- profile: "not-null",
67
- });
68
- useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
69
-
70
- RouteService.getCurrentPage = jest.fn();
71
- RouteService.getCurrentRoute = jest.fn();
72
- RouteService.cleanRedirect = jest.fn();
73
-
74
- act(() => {
75
- component = mount(
76
- <QueryClientProvider client={queryClient}>
77
- <Authorizer>
78
- <p>test</p>
79
- </Authorizer>
80
- </QueryClientProvider>
81
- );
82
- });
83
-
84
- component.update();
85
-
86
- expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
87
- expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
88
- expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
89
- expect(component.exists()).toBeTruthy();
90
- expect(component.find("BlockLoader").exists()).toBeTruthy();
91
- });
92
-
93
- it("should render children if current page is login", () => {
94
- let component: any;
95
-
96
- useAuthMock({
97
- secrets: null,
98
- });
99
- useUserMock({
100
- profile: null,
101
- });
102
- useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
103
-
104
- RouteService.getCurrentPage = jest.fn().mockReturnValue("/login");
105
- RouteService.getCurrentRoute = jest.fn();
106
- RouteService.cleanRedirect = jest.fn();
107
-
108
- act(() => {
109
- component = mount(
110
- <QueryClientProvider client={queryClient}>
111
- <Authorizer>
112
- <p>test</p>
113
- </Authorizer>
114
- </QueryClientProvider>
115
- );
116
- });
117
-
118
- component.update();
119
-
120
- expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
121
- expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
122
- expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
123
- expect(component.exists()).toBeTruthy();
124
- expect(component.find("BlockLoader").exists()).toBeTruthy();
125
- });
126
-
127
- it("should NOT render children if profile is loading or fetching", () => {
128
- let component: any;
129
-
130
- useAuthMock({
131
- secrets: null,
132
- });
133
- useUserMock({
134
- profile: null,
135
- });
136
- useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
137
-
138
- RouteService.getCurrentPage = jest.fn();
139
- RouteService.getCurrentRoute = jest.fn();
140
- RouteService.cleanRedirect = jest.fn();
141
-
142
- act(() => {
143
- component = mount(
144
- <QueryClientProvider client={queryClient}>
145
- <Authorizer>
146
- <p>test</p>
147
- </Authorizer>
148
- </QueryClientProvider>
149
- );
150
- });
151
-
152
- component.update();
153
-
154
- expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
155
- expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
156
- expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
157
- expect(component.exists()).toBeTruthy();
158
- expect(component.find("BlockLoader").exists()).toBeTruthy();
159
- });
160
-
161
- it("should NOT render children if unauthorized and current page is not login", () => {
162
- let component: any;
163
-
164
- useAuthMock({
165
- secrets: null,
166
- });
167
- useUserMock({
168
- profile: null,
169
- });
170
- useAuthApi(DEFAULT_PROFILE_RESPONSE);
171
-
172
- RouteService.getCurrentPage = jest.fn();
173
- RouteService.getCurrentRoute = jest.fn();
174
- RouteService.cleanRedirect = jest.fn();
175
-
176
- act(() => {
177
- component = mount(
178
- <QueryClientProvider client={queryClient}>
179
- <Authorizer>
180
- <p>test</p>
181
- </Authorizer>
182
- </QueryClientProvider>
183
- );
184
- });
185
-
186
- component.update();
187
-
188
- expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(3);
189
- expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(1);
190
- expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(1);
191
- expect(component.exists()).toBeTruthy();
192
- expect(component.find("BlockLoader").exists()).toBeTruthy();
193
- });
194
- });
@@ -1,43 +0,0 @@
1
- import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
2
- import { mount, shallow } from "enzyme";
3
- import * as React from "react";
4
- import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
5
- import useUserMock from "../../__mock__/hooks/useUserMock";
6
- import { UserNavDropDown } from "../../../src/auth/Layout/UserNavDropDown";
7
-
8
- jest.mock("react-i18next");
9
- jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
10
-
11
- describe("UserNavDropDown", () => {
12
- it("should be rendered without issues", () => {
13
- useTranslationMock({
14
- t: jest.fn(),
15
- });
16
- useUserMock({
17
- profile: null,
18
- });
19
-
20
- const component = shallow(<UserNavDropDown />);
21
-
22
- expect(component.exists()).toBeTruthy();
23
- });
24
-
25
- it("should logout on click", () => {
26
- useTranslationMock({
27
- t: jest.fn(),
28
- });
29
- useUserMock({
30
- logout: jest.fn(),
31
- });
32
-
33
- RouteService.redirectTo = jest.fn();
34
-
35
- const component = mount(<UserNavDropDown />);
36
-
37
- expect(component.exists()).toBeTruthy();
38
-
39
- component.children().prop("onClick")();
40
-
41
- expect(RouteService.redirectTo).toHaveBeenCalledTimes(1);
42
- });
43
- });
@@ -1,33 +0,0 @@
1
- import { IUser } from "@licklist/plugins/dist/types/context/user/IUser";
2
- import { shallow } from "enzyme";
3
- import * as React from "react";
4
- import { UserNavDropDownToggle } from "../../../src/auth/Layout/UserNavDropDownToggle";
5
- import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
6
-
7
- jest.mock("react-i18next");
8
- jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
9
-
10
- const user: IUser = {
11
- id: 1,
12
- first_name: "first_name",
13
- last_name: "last_name",
14
- email: "email",
15
- user_roles: [],
16
- user_detail: {
17
- postcode: "",
18
- birthday: "",
19
- phone: "",
20
- },
21
- };
22
-
23
- describe("UserNavDropDownToggle", () => {
24
- it("should be rendered without issues", () => {
25
- useTranslationMock({
26
- t: jest.fn(),
27
- });
28
-
29
- const component = shallow(<UserNavDropDownToggle user={user} />);
30
-
31
- expect(component.exists()).toBeTruthy();
32
- });
33
- });