@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.
- package/bitbucket-pipelines.yml +0 -8
- package/dist/iframe/event/event-card/IframeEventCard.d.ts +2 -1
- package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
- package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
- package/dist/index.js +1 -1
- package/dist/product-set/card/ProductSetCard.d.ts +2 -1
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +1 -1
- package/dist/product-set/control/DateInput.d.ts +17 -0
- package/dist/product-set/control/DateInput.d.ts.map +1 -0
- package/dist/product-set/control/DateInput.js +1 -0
- package/dist/product-set/control/ProductSetControl.d.ts +2 -1
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +1 -1
- package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts +11 -0
- package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts.map +1 -0
- package/dist/product-set/control/ProductSetRecurrenceOverridesControl.js +1 -0
- package/dist/product-set/control/TutorialGifCard.d.ts +2 -1
- package/dist/product-set/control/TutorialGifCard.d.ts.map +1 -1
- package/dist/product-set/control/TutorialGifCard.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts +2 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductSetForm.d.ts +7 -2
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +2 -1
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/form/StepsControl.d.ts +2 -1
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +1 -1
- package/dist/product-set/form/SubProductsControl.d.ts +2 -1
- package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/SubProductsControl.js +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts +2 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.js +1 -1
- package/dist/product-set/item/CreateProductSetItem.d.ts +2 -1
- package/dist/product-set/item/CreateProductSetItem.d.ts.map +1 -1
- package/dist/product-set/item/CreateProductSetItem.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts +2 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts +4 -2
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.js +1 -1
- package/dist/product-set/product/quantity/ProductQuantityControl.d.ts +1 -0
- package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityControl.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts +2 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
- package/dist/recurring-date-picker-input/DatePickerInput.d.ts +19 -0
- package/dist/recurring-date-picker-input/DatePickerInput.d.ts.map +1 -0
- package/dist/recurring-date-picker-input/DatePickerInput.js +1 -0
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts +15 -0
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -0
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.js +1 -0
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +2 -0
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +1 -1
- package/dist/sortable-list/SortableList.d.ts +2 -1
- package/dist/sortable-list/SortableList.d.ts.map +1 -1
- package/dist/sortable-list/SortableList.js +1 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts +3 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +1 -1
- package/dist/static/manual-date-picker/ManualDatePicker.js +1 -1
- package/dist/static/manual-date-picker/constants/index.d.ts +4 -1
- package/dist/static/manual-date-picker/constants/index.d.ts.map +1 -1
- package/dist/static/manual-date-picker/constants/index.js +1 -1
- package/dist/static/manual-date-picker/utils/index.d.ts +4 -0
- package/dist/static/manual-date-picker/utils/index.d.ts.map +1 -1
- package/dist/static/manual-date-picker/utils/index.js +1 -1
- package/dist/styles/availability-indicator/AvailabilityIndicator.scss +10 -0
- package/dist/styles/iframe-events/Card.scss +24 -8
- package/dist/styles/iframe-events/PoweredBy.scss +2 -2
- package/dist/styles/iframe-order-process/IframeOrderProcess.scss +0 -2
- package/dist/styles/iframe-page/Page.scss +1 -0
- package/dist/styles/iframe-page/PageBody.scss +32 -11
- package/dist/styles/iframe-page/PageHeader.scss +41 -39
- package/dist/styles/product-set/EditVenueMapSetModal.scss +1 -1
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/package.json +10 -33
- package/src/calendar/Calendar.stories.tsx +9 -2
- package/src/iframe/event/event-card/IframeEventCard.stories.tsx +1 -0
- package/src/iframe/event/event-card/IframeEventCard.tsx +7 -8
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
- package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +3 -1
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
- package/src/product-set/card/ProductSetCard.tsx +10 -1
- package/src/product-set/control/DateInput.tsx +309 -0
- package/src/product-set/control/ProductSetControl.tsx +46 -24
- package/src/product-set/control/ProductSetRecurrenceOverridesControl.tsx +63 -0
- package/src/product-set/control/TutorialGifCard.tsx +11 -3
- package/src/product-set/form/ProductCategoriesControl.tsx +12 -1
- package/src/product-set/form/ProductSetForm.tsx +10 -1
- package/src/product-set/form/ProductsControl.tsx +10 -0
- package/src/product-set/form/StepsControl.tsx +8 -2
- package/src/product-set/form/SubProductsControl.tsx +3 -0
- package/src/product-set/hooks/useSortableTreeFunctions.ts +6 -0
- package/src/product-set/item/CreateProductSetItem.tsx +3 -0
- package/src/product-set/product/ProductControl.tsx +23 -12
- package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +8 -2
- package/src/product-set/product/quantity/ProductQuantityControl.tsx +4 -3
- package/src/product-set/product-category/ProductCategoryControl.tsx +12 -8
- package/src/recurring-date-picker-input/DatePickerInput.tsx +93 -0
- package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +136 -0
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +4 -1
- package/src/sales/booking/results/BookingResults.stories.tsx +3 -2
- package/src/sales/booking/results/components/ResultCard.tsx +2 -5
- package/src/sortable-list/SortableList.tsx +3 -0
- package/src/sortable-tree/SortableTreeItem.tsx +6 -0
- package/src/static/manual-date-picker/ManualDatePicker.tsx +3 -3
- package/src/static/manual-date-picker/constants/index.ts +6 -2
- package/src/static/manual-date-picker/utils/index.ts +11 -0
- package/src/static/switch/BooleanSwitch.tsx +1 -1
- package/src/styles/availability-indicator/AvailabilityIndicator.scss +10 -0
- package/src/styles/iframe-events/Card.scss +24 -8
- package/src/styles/iframe-events/PoweredBy.scss +2 -2
- package/src/styles/iframe-order-process/IframeOrderProcess.scss +0 -2
- package/src/styles/iframe-page/Page.scss +1 -0
- package/src/styles/iframe-page/PageBody.scss +32 -11
- package/src/styles/iframe-page/PageHeader.scss +41 -39
- package/src/styles/product-set/EditVenueMapSetModal.scss +1 -1
- package/src/styles/sales/BookingResults.scss +1 -1
- package/jest.config.js +0 -29
- package/tests/Auth/Authorizer.test.tsx +0 -194
- package/tests/Auth/Layout/UserNavDropDown.test.tsx +0 -43
- package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +0 -33
- package/tests/Auth/Login/LoginComponent.test.tsx +0 -246
- package/tests/Auth/Login/LoginFormComponent.test.tsx +0 -182
- package/tests/Auth/Register/RegisterComponent.test.tsx +0 -285
- package/tests/Auth/Register/RegisterFormComponent.test.tsx +0 -170
- package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +0 -130
- package/tests/Auth/Social/SocialCallbackComponent.test.tsx +0 -133
- package/tests/Auth/Social/SocialFormComponent.test.tsx +0 -118
- package/tests/FileUpload/FileUpload.test.tsx +0 -42
- package/tests/Notification/EmailTemplate.test.tsx +0 -82
- package/tests/ProductSet/ProductSetPopover.test.tsx +0 -40
- package/tests/Report/Report.test.tsx +0 -48
- package/tests/Sales/Coupon.test.tsx +0 -51
- package/tests/Sales/SalesAndVIews.test.tsx +0 -63
- package/tests/SnippetTemplates/SnippetTemplates.test.tsx +0 -56
- package/tests/Table/FilterHelperComponent.test.tsx +0 -88
- package/tests/Table/PaginationHelperComponent.test.tsx +0 -109
- package/tests/Table/PerPageHelperComponent.test.tsx +0 -34
- package/tests/Table/TableHelperComponent.test.tsx +0 -295
- package/tests/TipTapEditor/TipTapEditor.test.tsx +0 -28
- package/tests/__mock__/hooks/useAuthApi.ts +0 -13
- package/tests/__mock__/hooks/useAuthMock.ts +0 -13
- package/tests/__mock__/hooks/useFormMock.ts +0 -27
- package/tests/__mock__/hooks/useNotificationMock.ts +0 -13
- package/tests/__mock__/hooks/useQueryMock.ts +0 -16
- package/tests/__mock__/hooks/useSocialApiMock.ts +0 -20
- package/tests/__mock__/hooks/useTranslationMock.ts +0 -17
- package/tests/__mock__/hooks/useUserApiMock.ts +0 -18
- package/tests/__mock__/hooks/useUserMock.ts +0 -13
- package/tests/__mock__/styleMock.js +0 -1
- package/tests/__mock__/windowMock.ts +0 -5
- package/tests/packages/react-query.tsx +0 -28
- 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:
|
|
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 -
|
|
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:
|
|
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
|
-
|
|
155
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
&.close-button {
|
|
50
|
+
margin-left: 1rem;
|
|
51
|
+
}
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
+
&:hover {
|
|
65
|
+
cursor: pointer;
|
|
64
66
|
}
|
|
67
|
+
}
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
}
|
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
|
-
});
|