@licklist/design 0.58.9 → 0.58.11-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bitbucket-pipelines.yml +0 -8
- package/dist/assets/iframe/calendar.svg +2 -2
- package/dist/assets/iframe/calendar.svg.js +1 -1
- package/dist/assets/iframe/ticket.svg +2 -2
- package/dist/assets/iframe/ticket.svg.js +1 -1
- package/dist/calendar/Calendar.d.ts +1 -1
- package/dist/calendar/Calendar.d.ts.map +1 -1
- package/dist/calendar/Calendar.js +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +2 -2
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
- package/dist/events/event-statistic-modal/EventStatisticModal.js +1 -1
- 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/event/event-venue-map/IframeEventVenueMap.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +2 -2
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts +4 -2
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.d.ts +4 -2
- package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +4 -0
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.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/page/components/PageBody/constants.d.ts +1 -0
- package/dist/iframe/page/components/PageBody/constants.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/constants.js +1 -1
- package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +1 -1
- package/dist/iframe/payment/order-items-table/OrderItemsTable.js +1 -1
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
- package/dist/iframe/payment/payment-form/PaymentForm.js +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
- package/dist/iframe/payment/payment-page/PaymentTimer.js +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
- package/dist/iframe/ryft/utils/ryft-form.d.ts +5 -0
- package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -0
- package/dist/iframe/ryft/utils/ryft-form.js +1 -0
- 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/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.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/form/VenueMapsControl.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 +3 -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/constants.d.ts +1 -0
- package/dist/product-set/product/constants.d.ts.map +1 -1
- package/dist/product-set/product/constants.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 +3 -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/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.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 +5 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
- package/dist/recurring-date-picker-input/utils.d.ts +9 -0
- package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/utils.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/sales/notes/NotesTableRow.js +1 -1
- package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
- package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
- package/dist/setting/dashboard/snippets/card/SnippetCard.js +1 -1
- package/dist/snippet/snippet-template/control/PropertyControl.d.ts +3 -1
- package/dist/snippet/snippet-template/control/PropertyControl.d.ts.map +1 -1
- package/dist/snippet/snippet-template/control/PropertyControl.js +1 -1
- package/dist/snippet/snippet-template/preview/Preview.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/striped-static-table/StripedStaticTable.js +1 -1
- 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 +57 -20
- package/dist/styles/iframe-page/Page.scss +1 -0
- package/dist/styles/iframe-page/PageBody.scss +34 -12
- package/dist/styles/iframe-page/PageHeader.scss +41 -39
- package/dist/styles/product-set/EditVenueMapSetModal.scss +1 -1
- package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +125 -2
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/venue-map-sets/form/components/VenueMapImageControl.js +1 -1
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/package.json +10 -35
- package/src/assets/iframe/calendar.svg +2 -2
- package/src/assets/iframe/ticket.svg +2 -2
- package/src/calendar/Calendar.stories.tsx +23 -0
- package/src/calendar/Calendar.tsx +5 -5
- package/src/calendar/components/CalendarDates/CalendarDates.tsx +0 -5
- 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/BookingSummary/BookingSummary.stories.tsx +9 -0
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +58 -7
- package/src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx +8 -0
- package/src/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.tsx +4 -4
- package/src/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.tsx +63 -10
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +4 -0
- 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/page/components/PageBody/constants.ts +2 -0
- package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +10 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
- package/src/iframe/payment/payment-page/PaymentPage.stories.tsx +546 -6
- package/src/iframe/payment/payment-page/PaymentPage.tsx +38 -29
- package/src/iframe/ryft/RyftPaymentForm.tsx +11 -5
- package/src/iframe/ryft/utils/ryft-form.ts +47 -0
- package/src/product-set/card/ProductSetCard.tsx +12 -1
- package/src/product-set/control/DateAndRecurrenceInput.tsx +2 -1
- package/src/product-set/control/DateInput.tsx +316 -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 +48 -15
- package/src/product-set/product/constants.ts +1 -0
- 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 +116 -50
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +4 -18
- 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 +15 -2
- package/src/recurring-date-picker-input/utils.ts +75 -0
- package/src/sales/booking/results/BookingResults.stories.tsx +3 -2
- package/src/sales/booking/results/components/ResultCard.tsx +2 -5
- package/src/setting/admin/AdminSettingForm.tsx +2 -2
- package/src/snippet/snippet-template/control/PropertyControl.tsx +6 -2
- package/src/sortable-list/SortableList.tsx +3 -0
- package/src/sortable-tree/SortableTreeItem.tsx +12 -4
- 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/iframe-events/Card.scss +24 -8
- package/src/styles/iframe-events/PoweredBy.scss +2 -2
- package/src/styles/iframe-order-process/IframeOrderProcess.scss +57 -20
- package/src/styles/iframe-page/Page.scss +1 -0
- package/src/styles/iframe-page/PageBody.scss +34 -12
- package/src/styles/iframe-page/PageHeader.scss +41 -39
- package/src/styles/product-set/EditVenueMapSetModal.scss +1 -1
- package/src/styles/ryft-payment-form/RyftPaymentForm.scss +125 -2
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/zone/form/utils/dates.ts +9 -10
- 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
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { mount } from "enzyme";
|
|
3
|
-
import { Button } from "react-bootstrap";
|
|
4
|
-
import { ProductSetPopover } from "../../src/product-set/popover/ProductSetPopover";
|
|
5
|
-
|
|
6
|
-
describe("Product Set Popover", () => {
|
|
7
|
-
it("should render without issues", () => {
|
|
8
|
-
const component = mount(
|
|
9
|
-
<ProductSetPopover>
|
|
10
|
-
<>Lorem ipsum dolor sit</>
|
|
11
|
-
</ProductSetPopover>
|
|
12
|
-
);
|
|
13
|
-
expect(component.exists()).toBeTruthy();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should be controlled if isVisible prop has been passed", () => {
|
|
17
|
-
const component = mount(
|
|
18
|
-
<ProductSetPopover isVisible={false}>
|
|
19
|
-
<p id="popover-content">Some text here...</p>
|
|
20
|
-
</ProductSetPopover>
|
|
21
|
-
);
|
|
22
|
-
const triggerButton = component.find(Button).first();
|
|
23
|
-
triggerButton.simulate("click");
|
|
24
|
-
const content = component.find("#popover-content");
|
|
25
|
-
|
|
26
|
-
expect(content).toHaveLength(0);
|
|
27
|
-
});
|
|
28
|
-
it("should be uncontrolled if isVisible has not been passed", () => {
|
|
29
|
-
const component = mount(
|
|
30
|
-
<ProductSetPopover>
|
|
31
|
-
<p id="popover-content">Some text here...</p>
|
|
32
|
-
</ProductSetPopover>
|
|
33
|
-
);
|
|
34
|
-
const triggerButton = component.find(Button).first();
|
|
35
|
-
triggerButton.simulate("click");
|
|
36
|
-
const content = component.find("#popover-content");
|
|
37
|
-
|
|
38
|
-
expect(content).toHaveLength(1);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { render } from "@testing-library/react";
|
|
4
|
-
import { createMemoryHistory } from "history";
|
|
5
|
-
import { Router } from "react-router-dom";
|
|
6
|
-
import { ReportCard } from "../../src/report/card/ReportCard";
|
|
7
|
-
import { ReportForm } from "../../src/report/form/ReportForm";
|
|
8
|
-
import useTranslationMock from "../__mock__/hooks/useTranslationMock";
|
|
9
|
-
|
|
10
|
-
const history = createMemoryHistory();
|
|
11
|
-
|
|
12
|
-
jest.mock("react-i18next", () => ({
|
|
13
|
-
Trans: jest.fn().mockReturnValue("test"),
|
|
14
|
-
useTranslation: jest.fn(),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
useTranslationMock();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
afterAll(() => {
|
|
22
|
-
jest.resetAllMocks();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe("Report", () => {
|
|
26
|
-
it("ReportCard should be rendered without issues", () => {
|
|
27
|
-
const screen = render(
|
|
28
|
-
<Router history={history as any}>
|
|
29
|
-
<ReportCard hasPermission name="Sales" onPress={() => {}} iconType="" />
|
|
30
|
-
</Router>
|
|
31
|
-
);
|
|
32
|
-
expect(screen.getByText("Sales")).toBeInTheDocument();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("ReportForm should be rendered without issues", () => {
|
|
36
|
-
const screen = render(
|
|
37
|
-
<ReportForm hasPermission onSubmit={() => {}} onHide={() => {}} />
|
|
38
|
-
);
|
|
39
|
-
expect(screen.getAllByRole("button")).toBeTruthy();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("ReportForm should not rendered button without valid permission", () => {
|
|
43
|
-
const screen = render(
|
|
44
|
-
<ReportForm hasPermission={false} onSubmit={() => {}} onHide={() => {}} />
|
|
45
|
-
);
|
|
46
|
-
expect(screen.queryByRole("button")).not.toBeInTheDocument();
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { render } from "@testing-library/react";
|
|
4
|
-
import { Router } from "react-router-dom";
|
|
5
|
-
import { createMemoryHistory } from "history";
|
|
6
|
-
|
|
7
|
-
import useTranslationMock from "../__mock__/hooks/useTranslationMock";
|
|
8
|
-
import { CouponForm } from "../../src/sales/coupon/form";
|
|
9
|
-
|
|
10
|
-
const history = createMemoryHistory();
|
|
11
|
-
|
|
12
|
-
jest.mock("react-i18next", () => ({
|
|
13
|
-
Trans: jest.fn().mockReturnValue("test"),
|
|
14
|
-
useTranslation: jest.fn(),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
useTranslationMock();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
afterAll(() => {
|
|
22
|
-
jest.resetAllMocks();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe("CouponFrom", () => {
|
|
26
|
-
it("CouponFrom should be rendered without issues with permission", () => {
|
|
27
|
-
const screen = render(
|
|
28
|
-
<Router history={history as any}>
|
|
29
|
-
<CouponForm
|
|
30
|
-
hasPermission
|
|
31
|
-
onSubmit={() => {}}
|
|
32
|
-
serverErrors={{ name: [""] }}
|
|
33
|
-
/>
|
|
34
|
-
</Router>
|
|
35
|
-
);
|
|
36
|
-
expect(screen.getByRole("button")).toBeTruthy();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("CouponFrom should be rendered without issues without permission", () => {
|
|
40
|
-
const screen = render(
|
|
41
|
-
<Router history={history as any}>
|
|
42
|
-
<CouponForm
|
|
43
|
-
hasPermission={false}
|
|
44
|
-
onSubmit={() => {}}
|
|
45
|
-
serverErrors={{ name: [""] }}
|
|
46
|
-
/>
|
|
47
|
-
</Router>
|
|
48
|
-
);
|
|
49
|
-
expect(screen.queryByRole("button")).toBeFalsy();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { render } from "@testing-library/react";
|
|
4
|
-
import moment from "moment";
|
|
5
|
-
import { IntlProvider } from "react-intl";
|
|
6
|
-
import useTranslationMock from "../__mock__/hooks/useTranslationMock";
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
ChartData,
|
|
10
|
-
SalesAndViewsChart,
|
|
11
|
-
} from "../../src/sales/sales-and-views/SalesAndViewsChart";
|
|
12
|
-
|
|
13
|
-
jest.mock("react-i18next", () => ({
|
|
14
|
-
Trans: jest.fn().mockReturnValue("test"),
|
|
15
|
-
useTranslation: jest.fn(),
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
useTranslationMock();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
afterAll(() => {
|
|
23
|
-
jest.resetAllMocks();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
function generateRandom() {
|
|
27
|
-
return Math.floor(Math.random() * 100);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const genarateChartData = (): ChartData[] => {
|
|
31
|
-
const chartData = [];
|
|
32
|
-
const date = moment().subtract(90, "d");
|
|
33
|
-
|
|
34
|
-
for (let i = 0; i < 90; i += 1) {
|
|
35
|
-
chartData.push({
|
|
36
|
-
id: i,
|
|
37
|
-
sales: generateRandom(),
|
|
38
|
-
views: generateRandom(),
|
|
39
|
-
date: date.add(i, "d").format("YYYY-MM-DD"),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return chartData;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
describe("SalesAndViewsChart", () => {
|
|
46
|
-
it("SalesAndViewsChart should be rendered without issues", () => {
|
|
47
|
-
const data = genarateChartData();
|
|
48
|
-
|
|
49
|
-
const screen = render(
|
|
50
|
-
<IntlProvider locale="en" timeZone="Europe/London">
|
|
51
|
-
<div style={{ height: "500px", width: "700px" }}>
|
|
52
|
-
<SalesAndViewsChart
|
|
53
|
-
data={data}
|
|
54
|
-
handleFilter={() => {}}
|
|
55
|
-
activePeriod="week"
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
</IntlProvider>
|
|
59
|
-
);
|
|
60
|
-
const salesHeaderContainer = screen.getAllByText("test");
|
|
61
|
-
expect(salesHeaderContainer[0]).toBeInTheDocument();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/* eslint-disable testing-library/render-result-naming-convention */
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { createMemoryHistory } from "history";
|
|
4
|
-
import { Router } from "react-router-dom";
|
|
5
|
-
import { render } from "@testing-library/react";
|
|
6
|
-
import { SnippetTemplateCard } from "../../src/setting/dashboard/snippet-templates/card";
|
|
7
|
-
import useTranslationMock from "../__mock__/hooks/useTranslationMock";
|
|
8
|
-
|
|
9
|
-
const history = createMemoryHistory();
|
|
10
|
-
|
|
11
|
-
jest.mock("react-i18next", () => ({
|
|
12
|
-
Trans: jest.fn().mockReturnValue("test"),
|
|
13
|
-
useTranslation: jest.fn(),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
useTranslationMock();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
afterAll(() => {
|
|
21
|
-
jest.resetAllMocks();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe("SnippetTemplates", () => {
|
|
25
|
-
it("SnippetTemplate should be rendered without issues", () => {
|
|
26
|
-
const screen = render(
|
|
27
|
-
<Router history={history as any}>
|
|
28
|
-
<SnippetTemplateCard
|
|
29
|
-
hasPermission
|
|
30
|
-
name="testSnippet"
|
|
31
|
-
onRemove={() => {}}
|
|
32
|
-
colors={["blue", "yellow"]}
|
|
33
|
-
href="/"
|
|
34
|
-
/>
|
|
35
|
-
</Router>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
expect(screen.getByRole("button")).toBeTruthy();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("SnippetTemplate without permission", async () => {
|
|
42
|
-
const screen = render(
|
|
43
|
-
<Router history={history as any}>
|
|
44
|
-
<SnippetTemplateCard
|
|
45
|
-
hasPermission={false}
|
|
46
|
-
name="testSnippet"
|
|
47
|
-
onRemove={() => {}}
|
|
48
|
-
colors={["blue", "yellow"]}
|
|
49
|
-
href="/"
|
|
50
|
-
/>
|
|
51
|
-
</Router>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
expect(screen.queryByRole("button")).toBeFalsy();
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { mount, shallow } from "enzyme";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { act } from "react-dom/test-utils";
|
|
4
|
-
import FormControl from "react-bootstrap/FormControl";
|
|
5
|
-
import Button from "react-bootstrap/Button";
|
|
6
|
-
import { FilterHelperComponent } from "../../src/table/FilterHelperComponent";
|
|
7
|
-
|
|
8
|
-
describe("FilterHelperComponent", () => {
|
|
9
|
-
it("should be rendered without issues", () => {
|
|
10
|
-
const component = shallow(<FilterHelperComponent />);
|
|
11
|
-
|
|
12
|
-
expect(component.exists()).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should be mount without issues", () => {
|
|
16
|
-
const component = mount(
|
|
17
|
-
<FilterHelperComponent defaultValue="defaultValue" />
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
expect(component.exists()).toBeTruthy();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should act on change", () => {
|
|
24
|
-
const component = mount(<FilterHelperComponent />);
|
|
25
|
-
|
|
26
|
-
act(() => {
|
|
27
|
-
component.find(FormControl).first().prop("onChange")?.({
|
|
28
|
-
target: {
|
|
29
|
-
value: "onChange",
|
|
30
|
-
},
|
|
31
|
-
} as React.ChangeEvent<HTMLInputElement>);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
component.update();
|
|
35
|
-
expect(component.find(FormControl).first().prop("value")).toBe("onChange");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("should act on clear", () => {
|
|
39
|
-
const onClickFn = jest.fn();
|
|
40
|
-
const component = mount(<FilterHelperComponent onClickFn={onClickFn} />);
|
|
41
|
-
|
|
42
|
-
act(() => {
|
|
43
|
-
component.find(Button).first().prop("onClick")?.(
|
|
44
|
-
{} as React.MouseEvent<HTMLButtonElement>
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
component.update();
|
|
49
|
-
expect(onClickFn).toHaveBeenCalledTimes(1);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("should act on search", () => {
|
|
53
|
-
const onClickFn = jest.fn();
|
|
54
|
-
const component = mount(<FilterHelperComponent onClickFn={onClickFn} />);
|
|
55
|
-
|
|
56
|
-
act(() => {
|
|
57
|
-
component.find(Button).last().prop("onClick")?.(
|
|
58
|
-
{} as React.MouseEvent<HTMLButtonElement>
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
component.update();
|
|
63
|
-
expect(onClickFn).toHaveBeenCalledTimes(1);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("should act on enter", () => {
|
|
67
|
-
const onClickFn = jest.fn();
|
|
68
|
-
const component = mount(<FilterHelperComponent onClickFn={onClickFn} />);
|
|
69
|
-
|
|
70
|
-
act(() => {
|
|
71
|
-
component.find(FormControl).last().prop("onKeyDown")?.({
|
|
72
|
-
key: "Space",
|
|
73
|
-
} as React.KeyboardEvent);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
component.update();
|
|
77
|
-
expect(onClickFn).toHaveBeenCalledTimes(0);
|
|
78
|
-
|
|
79
|
-
act(() => {
|
|
80
|
-
component.find(FormControl).last().prop("onKeyDown")?.({
|
|
81
|
-
key: "Enter",
|
|
82
|
-
} as React.KeyboardEvent);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
component.update();
|
|
86
|
-
expect(onClickFn).toHaveBeenCalledTimes(1);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
-
import ILengthAwarePaginator from "@licklist/plugins/dist/types/services/Table/ILengthAwarePaginator";
|
|
3
|
-
import { mount, shallow } from "enzyme";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import PageItem from "react-bootstrap/PageItem";
|
|
6
|
-
import { act } from "react-dom/test-utils";
|
|
7
|
-
import { PaginationHelperComponent } from "../../src/table/PaginationHelperComponent";
|
|
8
|
-
import useTranslationMock from "../__mock__/hooks/useTranslationMock";
|
|
9
|
-
|
|
10
|
-
jest.mock("react-i18next", () => ({
|
|
11
|
-
Trans: jest.fn().mockReturnValue("test"),
|
|
12
|
-
useTranslation: jest.fn(),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
useTranslationMock();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
afterAll(() => {
|
|
20
|
-
jest.resetAllMocks();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
describe("PaginationHelperComponent", () => {
|
|
24
|
-
const getPaginator = (): ILengthAwarePaginator<{}> => ({
|
|
25
|
-
current_page: 1,
|
|
26
|
-
last_page: 1,
|
|
27
|
-
first_page_url: "first_page_url",
|
|
28
|
-
last_page_url: "last_page_url",
|
|
29
|
-
next_page_url: "next_page_url",
|
|
30
|
-
prev_page_url: "prev_page_url",
|
|
31
|
-
path: "path",
|
|
32
|
-
per_page: 1,
|
|
33
|
-
from: 0,
|
|
34
|
-
to: 1,
|
|
35
|
-
total: 1,
|
|
36
|
-
data: [
|
|
37
|
-
{
|
|
38
|
-
test: "data",
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("should be rendered without issues", () => {
|
|
44
|
-
const component = shallow(<PaginationHelperComponent />);
|
|
45
|
-
|
|
46
|
-
expect(component.exists()).toBeTruthy();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("should be mount without issues", () => {
|
|
50
|
-
const component = mount(
|
|
51
|
-
<PaginationHelperComponent paginator={getPaginator()} />
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
expect(component.exists()).toBeTruthy();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("should render pagination section if there are more pages", () => {
|
|
58
|
-
const paginator = getPaginator();
|
|
59
|
-
paginator.last_page = 2;
|
|
60
|
-
const component = mount(
|
|
61
|
-
<PaginationHelperComponent paginator={paginator} />
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
expect(component.exists()).toBeTruthy();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("should act on page change", () => {
|
|
68
|
-
const paginator = getPaginator();
|
|
69
|
-
const onPageChangeFn = jest.fn();
|
|
70
|
-
paginator.last_page = 2;
|
|
71
|
-
const component = mount(
|
|
72
|
-
<PaginationHelperComponent
|
|
73
|
-
paginator={paginator}
|
|
74
|
-
onPageChangeFn={onPageChangeFn}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
act(() => {
|
|
79
|
-
component.find("button").first().prop("onClick")?.(
|
|
80
|
-
{} as React.MouseEvent<HTMLElement>
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
component.update();
|
|
85
|
-
expect(onPageChangeFn).toHaveBeenCalledTimes(1);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("should act on page change by click on a specific page", () => {
|
|
89
|
-
const paginator = getPaginator();
|
|
90
|
-
const onPageChangeFn = jest.fn();
|
|
91
|
-
paginator.last_page = 2;
|
|
92
|
-
const component = mount(
|
|
93
|
-
<PaginationHelperComponent
|
|
94
|
-
paginator={paginator}
|
|
95
|
-
onPageChangeFn={onPageChangeFn}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
act(() => {
|
|
100
|
-
component.find(PageItem).at(1).prop("onClick")?.(
|
|
101
|
-
{} as React.MouseEvent<HTMLElement>
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
component.update();
|
|
106
|
-
expect(onPageChangeFn).toHaveBeenCalledTimes(1);
|
|
107
|
-
expect(onPageChangeFn).toHaveBeenCalledWith(2);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { mount, shallow } from "enzyme";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { act } from "react-dom/test-utils";
|
|
4
|
-
import { PerPageHelperComponent } from "../../src/table/PerPageHelperComponent";
|
|
5
|
-
|
|
6
|
-
describe("PerPageHelperComponent", () => {
|
|
7
|
-
it("should be rendered without issues", () => {
|
|
8
|
-
const component = shallow(<PerPageHelperComponent />);
|
|
9
|
-
|
|
10
|
-
expect(component.exists()).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("should be mount without issues", () => {
|
|
14
|
-
const component = mount(<PerPageHelperComponent defaultValue={10} />);
|
|
15
|
-
|
|
16
|
-
expect(component.exists()).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should act on change", () => {
|
|
20
|
-
const onChangeFn = jest.fn();
|
|
21
|
-
const component = mount(<PerPageHelperComponent onChangeFn={onChangeFn} />);
|
|
22
|
-
|
|
23
|
-
act(() => {
|
|
24
|
-
component.find("select").first().prop("onChange")?.({
|
|
25
|
-
target: {
|
|
26
|
-
value: "100",
|
|
27
|
-
},
|
|
28
|
-
} as React.ChangeEvent<HTMLSelectElement>);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
component.update();
|
|
32
|
-
expect(onChangeFn).toHaveBeenCalledTimes(1);
|
|
33
|
-
});
|
|
34
|
-
});
|