@griddo/ax 11.14.2-rc.0 → 11.14.2
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/config/jest/reactEasyCropMock.js +15 -0
- package/config/jest/reactTimezoneMock.js +13 -0
- package/package.json +221 -219
- package/public/img/welcome.svg +127 -0
- package/src/__tests__/components/Browser/Browser.test.tsx +27 -51
- package/src/__tests__/components/CategoryCell/CategoryCell.test.tsx +10 -5
- package/src/__tests__/components/ElementsTooltip/ElementsTooltip.test.tsx +27 -14
- package/src/__tests__/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/ErrorItem.test.tsx +2 -0
- package/src/__tests__/components/HeadingsPreviewModal/HeadingsPreviewModal.utils.test.tsx +138 -1
- package/src/__tests__/components/ImageDragAndDrop/CropStep/CropStep.test.tsx +84 -0
- package/src/__tests__/components/ImageDragAndDrop/ImageDragAndDrop.test.tsx +173 -0
- package/src/__tests__/components/KeywordsPreviewModal/KeywordsPreviewModal.test.tsx +3 -4
- package/src/__tests__/components/ProfileImage/ProfileImage.test.tsx +120 -0
- package/src/__tests__/components/ResizePanel/ResizePanel.test.tsx +8 -0
- package/src/__tests__/components/UserRolesAndSites/RoleItem/RoleItem.test.tsx +190 -0
- package/src/__tests__/components/UserRolesAndSites/UserRolesAndSites.test.tsx +471 -0
- package/src/__tests__/modules/FramePreview/HeadingsOverlay/HeadingsOverlay.test.tsx +15 -2
- package/src/__tests__/modules/Sites/Sites.test.tsx +68 -224
- package/src/__tests__/modules/Sites/SitesList/ListView/BulkHeader/BulkHeader.test.tsx +21 -17
- package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +65 -565
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/DataStep/DataStep.test.tsx +109 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/FinalStep/FinalStep.test.tsx +157 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/CropView.test.tsx +51 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/ImageStep.test.tsx +70 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/ImageStep/UploadView/UploadView.test.tsx +92 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/TimezoneStep/TimezoneStep.test.tsx +94 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/WelcomeModal.test.tsx +78 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/WelcomeStep/WelcomeStep.test.tsx +39 -0
- package/src/__tests__/modules/Sites/SitesList/WelcomeModal/utils.test.ts +55 -0
- package/src/api/sites.tsx +4 -4
- package/src/components/Avatar/index.tsx +26 -5
- package/src/components/Avatar/style.tsx +20 -10
- package/src/components/Browser/index.tsx +7 -1
- package/src/components/ConfigPanel/index.tsx +11 -7
- package/src/components/ElementsTooltip/index.tsx +96 -34
- package/src/components/ElementsTooltip/style.tsx +12 -1
- package/src/components/Fields/FileField/index.tsx +16 -18
- package/src/components/Fields/HeadingField/index.tsx +1 -1
- package/src/components/Fields/ImageField/index.tsx +9 -38
- package/src/components/Fields/ImageField/style.tsx +12 -1
- package/src/components/Fields/ToggleField/index.tsx +1 -1
- package/src/components/Fields/Wysiwyg/index.tsx +25 -20
- package/src/components/FileGallery/GalleryPanel/index.tsx +15 -7
- package/src/components/FileGallery/index.tsx +33 -28
- package/src/components/Gallery/GalleryPanel/index.tsx +5 -16
- package/src/components/Gallery/index.tsx +0 -2
- package/src/components/HeadingsPreviewModal/ErrorsBanner/ErrorItem/index.tsx +11 -2
- package/src/components/HeadingsPreviewModal/ErrorsBanner/index.tsx +21 -3
- package/src/components/HeadingsPreviewModal/ErrorsBanner/style.tsx +2 -2
- package/src/components/HeadingsPreviewModal/index.tsx +13 -3
- package/src/components/HeadingsPreviewModal/style.tsx +18 -0
- package/src/components/HeadingsPreviewModal/utils.tsx +31 -3
- package/src/components/Image/index.tsx +2 -2
- package/src/components/ImageDragAndDrop/CropStep/index.tsx +95 -0
- package/src/components/ImageDragAndDrop/CropStep/style.tsx +101 -0
- package/src/{modules/MediaGallery → components}/ImageDragAndDrop/index.tsx +103 -40
- package/src/{modules/MediaGallery → components}/ImageDragAndDrop/style.tsx +14 -2
- package/src/components/KeywordsPreviewModal/atoms.tsx +2 -2
- package/src/components/KeywordsPreviewModal/index.tsx +6 -6
- package/src/components/KeywordsPreviewModal/utils.tsx +2 -2
- package/src/components/ProfileImage/index.tsx +55 -0
- package/src/components/ProfileImage/style.tsx +58 -0
- package/src/components/ResizePanel/ResizeHandle/index.tsx +44 -6
- package/src/components/ResizePanel/ResizeHandle/style.tsx +7 -0
- package/src/components/ResizePanel/index.tsx +25 -4
- package/src/components/Tabs/style.tsx +1 -1
- package/src/components/Tag/index.tsx +0 -1
- package/src/components/UserRolesAndSites/RoleItem/index.tsx +42 -0
- package/src/components/UserRolesAndSites/RoleItem/style.tsx +29 -0
- package/src/components/UserRolesAndSites/index.tsx +102 -0
- package/src/components/UserRolesAndSites/style.tsx +67 -0
- package/src/components/index.tsx +6 -0
- package/src/constants/index.ts +13 -1
- package/src/containers/App/actions.tsx +8 -1
- package/src/containers/Sites/actions.tsx +26 -0
- package/src/containers/Sites/constants.tsx +1 -0
- package/src/containers/Sites/interfaces.tsx +6 -0
- package/src/containers/Sites/reducer.tsx +5 -1
- package/src/containers/Users/reducer.tsx +6 -5
- package/src/guards/routeLeaving/index.tsx +9 -11
- package/src/helpers/images.tsx +50 -3
- package/src/helpers/index.tsx +2 -1
- package/src/hooks/forms.tsx +45 -48
- package/src/hooks/index.tsx +2 -1
- package/src/hooks/modals.tsx +4 -3
- package/src/hooks/window.ts +50 -2
- package/src/modules/ActivityLog/ItemLogUser/UserItem/index.tsx +1 -1
- package/src/modules/App/Routing/Logout/index.tsx +3 -5
- package/src/modules/App/Routing/NavMenu/NavItem/index.tsx +73 -52
- package/src/modules/App/Routing/NavMenu/NavItem/style.tsx +21 -7
- package/src/modules/App/Routing/NavMenu/index.tsx +59 -54
- package/src/modules/App/Routing/NavMenu/style.tsx +13 -11
- package/src/modules/CreatePass/index.tsx +1 -1
- package/src/modules/FileDrive/FileDragAndDrop/index.tsx +11 -8
- package/src/modules/FileDrive/FileModal/index.tsx +8 -9
- package/src/modules/FileDrive/index.tsx +1 -18
- package/src/modules/Forms/FormEditor/index.tsx +1 -1
- package/src/modules/FramePreview/HeadingsOverlay/index.tsx +22 -11
- package/src/modules/FramePreview/HeadingsOverlay/style.tsx +1 -1
- package/src/modules/MediaGallery/ImageModal/index.tsx +1 -5
- package/src/modules/MediaGallery/index.tsx +1 -3
- package/src/modules/Settings/Globals/constants.tsx +942 -106
- package/src/modules/Sites/SitesList/AllSitesHeader/index.tsx +33 -0
- package/src/modules/Sites/SitesList/AllSitesHeader/style.tsx +35 -0
- package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +5 -5
- package/src/modules/Sites/SitesList/GridView/GridSiteItem/index.tsx +23 -119
- package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +4 -4
- package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +4 -3
- package/src/modules/Sites/SitesList/ListView/ListSiteItem/index.tsx +23 -120
- package/src/modules/Sites/SitesList/{RecentSiteItem → RecentSites/RecentSiteItem}/index.tsx +4 -5
- package/src/modules/Sites/SitesList/RecentSites/index.tsx +49 -0
- package/src/modules/Sites/SitesList/RecentSites/style.tsx +92 -0
- package/src/modules/Sites/SitesList/SiteModal/index.tsx +8 -7
- package/src/modules/Sites/SitesList/WelcomeModal/DataStep/index.tsx +72 -0
- package/src/modules/Sites/SitesList/WelcomeModal/DataStep/style.tsx +59 -0
- package/src/modules/Sites/SitesList/WelcomeModal/FinalStep/constants.tsx +78 -0
- package/src/modules/Sites/SitesList/WelcomeModal/FinalStep/index.tsx +78 -0
- package/src/modules/Sites/SitesList/WelcomeModal/FinalStep/style.tsx +141 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/index.tsx +93 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/CropView/style.tsx +77 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/UploadView/index.tsx +100 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/UploadView/style.tsx +94 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/index.tsx +44 -0
- package/src/modules/Sites/SitesList/WelcomeModal/ImageStep/style.tsx +31 -0
- package/src/modules/Sites/SitesList/WelcomeModal/TimezoneStep/index.tsx +51 -0
- package/src/modules/Sites/SitesList/WelcomeModal/TimezoneStep/style.tsx +52 -0
- package/src/modules/Sites/SitesList/WelcomeModal/WelcomeStep/index.tsx +40 -0
- package/src/modules/Sites/SitesList/WelcomeModal/WelcomeStep/style.tsx +53 -0
- package/src/modules/Sites/SitesList/WelcomeModal/index.tsx +215 -0
- package/src/modules/Sites/SitesList/WelcomeModal/style.tsx +12 -0
- package/src/modules/Sites/SitesList/WelcomeModal/utils.ts +26 -0
- package/src/modules/Sites/SitesList/atoms.tsx +4 -4
- package/src/modules/Sites/SitesList/hooks.tsx +149 -16
- package/src/modules/Sites/SitesList/index.tsx +127 -125
- package/src/modules/Sites/SitesList/style.tsx +1 -117
- package/src/modules/Sites/SitesList/utils.tsx +9 -2
- package/src/modules/Sites/index.tsx +19 -8
- package/src/modules/Users/Profile/index.tsx +169 -31
- package/src/modules/Users/Profile/style.tsx +81 -1
- package/src/modules/Users/Roles/RoleItem/index.tsx +2 -2
- package/src/modules/Users/UserCreate/SiteItem/index.tsx +11 -14
- package/src/modules/Users/UserForm/atoms.tsx +3 -3
- package/src/modules/Users/UserForm/index.tsx +25 -29
- package/src/modules/Users/UserForm/style.tsx +15 -2
- package/src/modules/Users/UserList/UserItem/index.tsx +4 -4
- package/src/routes/index.tsx +1 -0
- package/src/types/index.tsx +2 -0
- /package/src/modules/Sites/SitesList/{RecentSiteItem → RecentSites/RecentSiteItem}/style.tsx +0 -0
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import axios from "axios";
|
|
3
1
|
import { Router } from "react-router-dom";
|
|
4
2
|
|
|
5
|
-
import { CalledWithMock, mock } from "jest-mock-extended";
|
|
6
|
-
import configureStore from "redux-mock-store";
|
|
7
|
-
import thunk from "redux-thunk";
|
|
8
|
-
import { ThemeProvider } from "styled-components";
|
|
9
|
-
|
|
10
3
|
import { parseTheme } from "@ax/helpers";
|
|
4
|
+
import SitesList, { type ISitesListProps } from "@ax/modules/Sites/SitesList";
|
|
11
5
|
import { history } from "@ax/routes";
|
|
12
6
|
import globalTheme from "@ax/themes/theme.json";
|
|
13
|
-
import { IGetSitesParams, ISettingsForm } from "@ax/types";
|
|
14
|
-
import SitesList, { ISitesListProps } from "@ax/modules/Sites/SitesList";
|
|
15
7
|
|
|
16
|
-
import
|
|
8
|
+
import axios from "axios";
|
|
9
|
+
import { mock } from "jest-mock-extended";
|
|
10
|
+
import configureStore from "redux-mock-store";
|
|
11
|
+
import thunk from "redux-thunk";
|
|
12
|
+
import { ThemeProvider } from "styled-components";
|
|
17
13
|
|
|
18
|
-
import {
|
|
14
|
+
import { act, cleanup, fireEvent, render, screen, waitFor } from "./../../../../../config/jest/test-utils";
|
|
19
15
|
import { sitesResponse } from "./../../../../__mocks__/axios/SitesList";
|
|
20
|
-
import { sitesResponseDataPack } from "./../../../../__mocks__/axios/SitesListDataPack";
|
|
21
|
-
import { sitesResponseCategories } from "./../../../../__mocks__/axios/SitesListCategories";
|
|
22
16
|
import { sitesOptions } from "./../../../../__mocks__/axios/SitesListOptions";
|
|
17
|
+
import { sitesDataMock, sitesDataNoThumbnailMock, userDataMock } from "./../../../../__mocks__/store/SitesList";
|
|
23
18
|
|
|
24
19
|
afterEach(cleanup);
|
|
25
20
|
|
|
@@ -27,6 +22,8 @@ const defaultProps = mock<ISitesListProps>();
|
|
|
27
22
|
jest.mock("axios");
|
|
28
23
|
const mockedAxios = axios as jest.MockedFunction<typeof axios>;
|
|
29
24
|
|
|
25
|
+
const mockStore = configureStore([thunk]);
|
|
26
|
+
|
|
30
27
|
const initialStore = {
|
|
31
28
|
app: {
|
|
32
29
|
isLoading: false,
|
|
@@ -35,6 +32,7 @@ const initialStore = {
|
|
|
35
32
|
{ id: 2, locale: "es_ES", language: "Spanish", label: "ES", isDefault: false },
|
|
36
33
|
],
|
|
37
34
|
token: "eyJhbGciOiJIUzI",
|
|
35
|
+
hasAnimation: true,
|
|
38
36
|
},
|
|
39
37
|
users: userDataMock,
|
|
40
38
|
sites: sitesDataMock,
|
|
@@ -44,44 +42,27 @@ const initialStore = {
|
|
|
44
42
|
},
|
|
45
43
|
};
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const setHistoryPushMock = jest.fn();
|
|
52
|
-
const saveSettingsMock = jest.fn();
|
|
53
|
-
const publishSitesBulkMock = jest.fn();
|
|
54
|
-
const unpublishSitesBulkMock = jest.fn();
|
|
55
|
-
defaultProps.getSites = getSitesMock as CalledWithMock<void, [params: IGetSitesParams]> &
|
|
56
|
-
((params: IGetSitesParams) => void);
|
|
57
|
-
defaultProps.setHistoryPush = setHistoryPushMock as CalledWithMock<
|
|
58
|
-
void,
|
|
59
|
-
[path: string, isEditor?: boolean | undefined]
|
|
60
|
-
>;
|
|
61
|
-
defaultProps.saveSettings = saveSettingsMock as CalledWithMock<Promise<boolean>, [form: ISettingsForm]> &
|
|
62
|
-
((form: ISettingsForm) => Promise<boolean>);
|
|
63
|
-
defaultProps.publishSitesBulk = publishSitesBulkMock as CalledWithMock<void, [ids: number[]]> &
|
|
64
|
-
((ids: number[]) => void);
|
|
65
|
-
defaultProps.unpublishSitesBulk = unpublishSitesBulkMock as CalledWithMock<void, [ids: number[]]> &
|
|
66
|
-
((ids: number[]) => void);
|
|
67
|
-
|
|
68
|
-
const middlewares: any = [thunk];
|
|
69
|
-
const mockStore = configureStore(middlewares);
|
|
70
|
-
const store = mockStore(initialStore);
|
|
71
|
-
|
|
72
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
73
|
-
|
|
74
|
-
const Component = (
|
|
45
|
+
const renderSitesList = async (storeData: any = initialStore) => {
|
|
46
|
+
const store = mockStore(storeData);
|
|
47
|
+
await act(async () => {
|
|
48
|
+
render(
|
|
75
49
|
<Router history={history}>
|
|
76
50
|
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
77
|
-
<SitesList {...
|
|
51
|
+
<SitesList {...{ ...storeData, ...defaultProps }} />
|
|
78
52
|
</ThemeProvider>
|
|
79
|
-
</Router
|
|
53
|
+
</Router>,
|
|
54
|
+
{ store },
|
|
80
55
|
);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
81
58
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
beforeEach(() => {
|
|
60
|
+
mockedAxios.mockResolvedValue(sitesResponse);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe("Sites module rendering", () => {
|
|
64
|
+
it("should render recent sites list when there are recent sites", async () => {
|
|
65
|
+
await renderSitesList();
|
|
85
66
|
|
|
86
67
|
const recentSitesList = screen.getByTestId("recent-sites-list");
|
|
87
68
|
const recentSitesItems = screen.getAllByTestId("recent-sites-item");
|
|
@@ -101,154 +82,44 @@ describe("Sites module rendering", () => {
|
|
|
101
82
|
});
|
|
102
83
|
|
|
103
84
|
it("should render default sites list view", async () => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<Router history={history}>
|
|
113
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
114
|
-
<SitesList {...initialState} />
|
|
115
|
-
</ThemeProvider>
|
|
116
|
-
</Router>
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
await act(async () => {
|
|
120
|
-
render(Component, { store });
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const sectionHeader = screen.getByTestId("all-sites-header");
|
|
124
|
-
const title = screen.getByTestId("all-sites-title");
|
|
125
|
-
const headerIconsWrapper = screen.getByTestId("all-sites-header-icons");
|
|
126
|
-
const filterSelect = screen.getByTestId("all-sites-grid-filter");
|
|
127
|
-
const filterSelectLabel = screen.getByTestId("all-sites-grid-filter-label");
|
|
128
|
-
const sitesGridList = screen.getByTestId("sites-grid-list");
|
|
129
|
-
|
|
130
|
-
expect(sectionHeader).toBeTruthy();
|
|
131
|
-
expect(title).toBeTruthy();
|
|
132
|
-
expect(headerIconsWrapper).toBeTruthy();
|
|
133
|
-
expect(filterSelect).toBeTruthy();
|
|
134
|
-
expect(filterSelectLabel).toBeTruthy();
|
|
135
|
-
expect(sitesGridList).toBeTruthy();
|
|
85
|
+
await renderSitesList();
|
|
86
|
+
|
|
87
|
+
expect(screen.getByTestId("all-sites-header")).toBeTruthy();
|
|
88
|
+
expect(screen.getByTestId("all-sites-title")).toBeTruthy();
|
|
89
|
+
expect(screen.getByTestId("all-sites-header-icons")).toBeTruthy();
|
|
90
|
+
expect(screen.getByTestId("all-sites-grid-filter")).toBeTruthy();
|
|
91
|
+
expect(screen.getByTestId("all-sites-grid-filter-label")).toBeTruthy();
|
|
92
|
+
expect(screen.getByTestId("sites-grid-list")).toBeTruthy();
|
|
136
93
|
});
|
|
137
94
|
|
|
138
95
|
it("should not render recent sites list when recent sites list is empty", async () => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
isLoading: false,
|
|
142
|
-
globalLangs: [
|
|
143
|
-
{ id: 4, locale: "en_GB", language: "English", label: "EN", isDefault: true },
|
|
144
|
-
{ id: 2, locale: "es_ES", language: "Spanish", label: "ES", isDefault: false },
|
|
145
|
-
],
|
|
146
|
-
token: "eyJhbGciOiJIUzI",
|
|
147
|
-
},
|
|
148
|
-
users: userDataMock,
|
|
96
|
+
await renderSitesList({
|
|
97
|
+
...initialStore,
|
|
149
98
|
sites: { totalItems: 2, sites: sitesDataMock.sites, recentSites: [], config: sitesDataMock.config },
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const middlewares: any = [thunk];
|
|
153
|
-
const mockStore = configureStore(middlewares);
|
|
154
|
-
const store = mockStore(initialStore);
|
|
155
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
156
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
157
|
-
|
|
158
|
-
const Component = (
|
|
159
|
-
<Router history={history}>
|
|
160
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
161
|
-
<SitesList {...initialState} />
|
|
162
|
-
</ThemeProvider>
|
|
163
|
-
</Router>
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
await act(async () => {
|
|
167
|
-
render(Component, { store });
|
|
168
99
|
});
|
|
169
100
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
expect(recentSitesList).not.toBeTruthy();
|
|
101
|
+
expect(screen.queryByTestId("recent-sites-list")).not.toBeTruthy();
|
|
173
102
|
});
|
|
174
103
|
|
|
175
104
|
it("should render empty state when no sites", async () => {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
globalLangs: [
|
|
180
|
-
{ id: 4, locale: "en_GB", language: "English", label: "EN", isDefault: true },
|
|
181
|
-
{ id: 2, locale: "es_ES", language: "Spanish", label: "ES", isDefault: false },
|
|
182
|
-
],
|
|
183
|
-
token: "eyJhbGciOiJIUzI",
|
|
184
|
-
},
|
|
185
|
-
users: userDataMock,
|
|
186
|
-
sites: {
|
|
187
|
-
totalItems: 0,
|
|
188
|
-
sites: [],
|
|
189
|
-
recentSites: [],
|
|
190
|
-
config: sitesDataMock.config,
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
const middlewares: any = [thunk];
|
|
195
|
-
const mockStore = configureStore(middlewares);
|
|
196
|
-
const store = mockStore(initialStore);
|
|
197
|
-
|
|
198
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
199
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
200
|
-
|
|
201
|
-
const Component = (
|
|
202
|
-
<Router history={history}>
|
|
203
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
204
|
-
<SitesList {...initialState} />
|
|
205
|
-
</ThemeProvider>
|
|
206
|
-
</Router>
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
await act(async () => {
|
|
210
|
-
render(Component, { store });
|
|
105
|
+
await renderSitesList({
|
|
106
|
+
...initialStore,
|
|
107
|
+
sites: { totalItems: 0, sites: [], recentSites: [], config: sitesDataMock.config },
|
|
211
108
|
});
|
|
212
109
|
|
|
213
|
-
|
|
214
|
-
expect(emptyState).toBeTruthy();
|
|
110
|
+
expect(screen.getByTestId("empty-state")).toBeTruthy();
|
|
215
111
|
});
|
|
216
112
|
|
|
217
113
|
it("should render full name when length is not too long", async () => {
|
|
218
|
-
|
|
219
|
-
const mockStore = configureStore(middlewares);
|
|
220
|
-
const store = mockStore(initialStore);
|
|
221
|
-
|
|
222
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
223
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
224
|
-
|
|
225
|
-
const Component = (
|
|
226
|
-
<Router history={history}>
|
|
227
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
228
|
-
<SitesList {...initialState} />
|
|
229
|
-
</ThemeProvider>
|
|
230
|
-
</Router>
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
await act(async () => {
|
|
234
|
-
render(Component, { store });
|
|
235
|
-
});
|
|
114
|
+
await renderSitesList();
|
|
236
115
|
|
|
237
116
|
const itemNames = screen.getAllByTestId("sites-item-name");
|
|
238
117
|
expect(itemNames.length).toEqual(4);
|
|
239
118
|
});
|
|
240
119
|
|
|
241
120
|
it("should render tooltip when full name is too long", async () => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
isLoading: false,
|
|
245
|
-
globalLangs: [
|
|
246
|
-
{ id: 4, locale: "en_GB", language: "English", label: "EN", isDefault: true },
|
|
247
|
-
{ id: 2, locale: "es_ES", language: "Spanish", label: "ES", isDefault: false },
|
|
248
|
-
],
|
|
249
|
-
token: "eyJhbGciOiJIUzI",
|
|
250
|
-
},
|
|
251
|
-
users: userDataMock,
|
|
121
|
+
await renderSitesList({
|
|
122
|
+
...initialStore,
|
|
252
123
|
sites: {
|
|
253
124
|
totalItems: 2,
|
|
254
125
|
sites: [
|
|
@@ -284,24 +155,6 @@ describe("Sites module rendering", () => {
|
|
|
284
155
|
config: sitesDataMock.config,
|
|
285
156
|
recentSites: sitesDataMock.recentSites,
|
|
286
157
|
},
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const middlewares: any = [thunk];
|
|
290
|
-
const mockStore = configureStore(middlewares);
|
|
291
|
-
const store = mockStore(initialStore);
|
|
292
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
293
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
294
|
-
|
|
295
|
-
const Component = (
|
|
296
|
-
<Router history={history}>
|
|
297
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
298
|
-
<SitesList {...initialState} />
|
|
299
|
-
</ThemeProvider>
|
|
300
|
-
</Router>
|
|
301
|
-
);
|
|
302
|
-
|
|
303
|
-
await act(async () => {
|
|
304
|
-
render(Component, { store });
|
|
305
158
|
});
|
|
306
159
|
|
|
307
160
|
const tooltip = screen.getAllByTestId("tooltip-component");
|
|
@@ -311,58 +164,16 @@ describe("Sites module rendering", () => {
|
|
|
311
164
|
});
|
|
312
165
|
|
|
313
166
|
it("should render custom thumbnail if site has one", async () => {
|
|
314
|
-
|
|
315
|
-
const mockStore = configureStore(middlewares);
|
|
316
|
-
const store = mockStore(initialStore);
|
|
317
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
318
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
319
|
-
|
|
320
|
-
const Component = (
|
|
321
|
-
<Router history={history}>
|
|
322
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
323
|
-
<SitesList {...initialState} />
|
|
324
|
-
</ThemeProvider>
|
|
325
|
-
</Router>
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
await act(async () => {
|
|
329
|
-
render(Component, { store });
|
|
330
|
-
});
|
|
167
|
+
await renderSitesList();
|
|
331
168
|
|
|
332
169
|
const thumbnail = screen.getAllByTestId("sites-item-thumbnail-wrapper");
|
|
333
170
|
expect(thumbnail.length).toEqual(4);
|
|
334
171
|
});
|
|
335
172
|
|
|
336
173
|
it("should render placeholder if site does not have thumbnail", async () => {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
isLoading: false,
|
|
340
|
-
globalLangs: [
|
|
341
|
-
{ id: 4, locale: "en_GB", language: "English", label: "EN", isDefault: true },
|
|
342
|
-
{ id: 2, locale: "es_ES", language: "Spanish", label: "ES", isDefault: false },
|
|
343
|
-
],
|
|
344
|
-
token: "eyJhbGciOiJIUzI",
|
|
345
|
-
},
|
|
346
|
-
users: userDataMock,
|
|
174
|
+
await renderSitesList({
|
|
175
|
+
...initialStore,
|
|
347
176
|
sites: sitesDataNoThumbnailMock,
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const middlewares: any = [thunk];
|
|
351
|
-
const mockStore = configureStore(middlewares);
|
|
352
|
-
const store = mockStore(initialStore);
|
|
353
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
354
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
355
|
-
|
|
356
|
-
const Component = (
|
|
357
|
-
<Router history={history}>
|
|
358
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
359
|
-
<SitesList {...initialState} />
|
|
360
|
-
</ThemeProvider>
|
|
361
|
-
</Router>
|
|
362
|
-
);
|
|
363
|
-
|
|
364
|
-
await act(async () => {
|
|
365
|
-
render(Component, { store });
|
|
366
177
|
});
|
|
367
178
|
|
|
368
179
|
const sitesItemThumbnail = screen.getAllByTestId("sites-item-thumbnail");
|
|
@@ -372,23 +183,8 @@ describe("Sites module rendering", () => {
|
|
|
372
183
|
|
|
373
184
|
describe("Sites module events", () => {
|
|
374
185
|
it("should hide recent sites on click collapse button", async () => {
|
|
375
|
-
|
|
376
|
-
const mockStore = configureStore(middlewares);
|
|
377
|
-
const store = mockStore(initialStore);
|
|
378
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
379
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
380
|
-
|
|
381
|
-
const Component = (
|
|
382
|
-
<Router history={history}>
|
|
383
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
384
|
-
<SitesList {...initialState} />
|
|
385
|
-
</ThemeProvider>
|
|
386
|
-
</Router>
|
|
387
|
-
);
|
|
186
|
+
await renderSitesList();
|
|
388
187
|
|
|
389
|
-
await act(async () => {
|
|
390
|
-
render(Component, { store });
|
|
391
|
-
});
|
|
392
188
|
const collapseButton = screen.getByTestId("recent-sites-collapse-button");
|
|
393
189
|
const hideButtonLabel = screen.getByTestId("recent-sites-hide-label");
|
|
394
190
|
|
|
@@ -402,48 +198,10 @@ describe("Sites module events", () => {
|
|
|
402
198
|
|
|
403
199
|
it("should go to site on click recent site item", async () => {
|
|
404
200
|
window.HTMLElement.prototype.scrollTo = jest.fn();
|
|
405
|
-
const middlewares: any = [thunk];
|
|
406
|
-
const mockStore = configureStore(middlewares);
|
|
407
|
-
const store = mockStore(initialStore);
|
|
408
|
-
const setHistoryPushMock = jest.fn();
|
|
409
|
-
defaultProps.setHistoryPush = setHistoryPushMock as CalledWithMock<
|
|
410
|
-
void,
|
|
411
|
-
[path: string, isEditor?: boolean | undefined]
|
|
412
|
-
>;
|
|
413
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
414
|
-
mockedAxios.mockImplementation((request: any) => {
|
|
415
|
-
switch (request.url) {
|
|
416
|
-
case "undefined/site/3/languages":
|
|
417
|
-
case "undefined/site/global/metrics":
|
|
418
|
-
case "undefined/site/3/metrics":
|
|
419
|
-
case "undefined/site/3/socials":
|
|
420
|
-
case "undefined/site/undefined/templates":
|
|
421
|
-
case "undefined/site/3/structured_data":
|
|
422
|
-
return Promise.resolve(sitesResponse);
|
|
423
|
-
case "undefined/sites?recentSitesNumber=7&pagination=true&page=1&itemsPerPage=30&order=lastAccess-desc":
|
|
424
|
-
case "undefined/site/3/data_pack/?status=activated":
|
|
425
|
-
return Promise.resolve(sitesResponseDataPack);
|
|
426
|
-
case "undefined/site/undefined/modules":
|
|
427
|
-
return Promise.resolve(sitesResponseCategories);
|
|
428
|
-
default:
|
|
429
|
-
return Promise.reject({ status: 500 });
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
const Component = (
|
|
434
|
-
<Router history={history}>
|
|
435
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
436
|
-
<SitesList {...initialState} />
|
|
437
|
-
</ThemeProvider>
|
|
438
|
-
</Router>
|
|
439
|
-
);
|
|
440
201
|
|
|
441
|
-
await
|
|
442
|
-
render(Component, { store });
|
|
443
|
-
});
|
|
202
|
+
await renderSitesList();
|
|
444
203
|
|
|
445
204
|
const recentSiteItems = screen.getAllByTestId("recent-sites-item");
|
|
446
|
-
|
|
447
205
|
expect(recentSiteItems.length).toEqual(2);
|
|
448
206
|
|
|
449
207
|
fireEvent.click(recentSiteItems[0]);
|
|
@@ -451,23 +209,7 @@ describe("Sites module events", () => {
|
|
|
451
209
|
});
|
|
452
210
|
|
|
453
211
|
it("should display list view on click list option button", async () => {
|
|
454
|
-
|
|
455
|
-
const mockStore = configureStore(middlewares);
|
|
456
|
-
const store = mockStore(initialStore);
|
|
457
|
-
|
|
458
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
459
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
460
|
-
const Component = (
|
|
461
|
-
<Router history={history}>
|
|
462
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
463
|
-
<SitesList {...initialState} />
|
|
464
|
-
</ThemeProvider>
|
|
465
|
-
</Router>
|
|
466
|
-
);
|
|
467
|
-
|
|
468
|
-
await act(async () => {
|
|
469
|
-
render(Component, { store });
|
|
470
|
-
});
|
|
212
|
+
await renderSitesList();
|
|
471
213
|
|
|
472
214
|
const gridIconAction = screen.getByTestId("icon-action-Grid2");
|
|
473
215
|
const listIconAction = screen.getByTestId("icon-action-BulletList");
|
|
@@ -482,28 +224,8 @@ describe("Sites module events", () => {
|
|
|
482
224
|
|
|
483
225
|
it("should go to site on click list site item", async () => {
|
|
484
226
|
window.HTMLElement.prototype.scrollTo = jest.fn();
|
|
485
|
-
const middlewares: any = [thunk];
|
|
486
|
-
const mockStore = configureStore(middlewares);
|
|
487
|
-
const store = mockStore(initialStore);
|
|
488
|
-
const setHistoryPushMock = jest.fn();
|
|
489
|
-
defaultProps.setHistoryPush = setHistoryPushMock as CalledWithMock<
|
|
490
|
-
void,
|
|
491
|
-
[path: string, isEditor?: boolean | undefined]
|
|
492
|
-
>;
|
|
493
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
494
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
495
|
-
|
|
496
|
-
const Component = (
|
|
497
|
-
<Router history={history}>
|
|
498
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
499
|
-
<SitesList {...initialState} />
|
|
500
|
-
</ThemeProvider>
|
|
501
|
-
</Router>
|
|
502
|
-
);
|
|
503
227
|
|
|
504
|
-
await
|
|
505
|
-
render(Component, { store });
|
|
506
|
-
});
|
|
228
|
+
await renderSitesList();
|
|
507
229
|
|
|
508
230
|
const gridIconAction = screen.getByTestId("icon-action-Grid2");
|
|
509
231
|
const listIconAction = screen.getByTestId("icon-action-BulletList");
|
|
@@ -520,24 +242,7 @@ describe("Sites module events", () => {
|
|
|
520
242
|
});
|
|
521
243
|
|
|
522
244
|
it("should display grid view on click grid option button", async () => {
|
|
523
|
-
|
|
524
|
-
const mockStore = configureStore(middlewares);
|
|
525
|
-
const store = mockStore(initialStore);
|
|
526
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
527
|
-
|
|
528
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
529
|
-
|
|
530
|
-
const Component = (
|
|
531
|
-
<Router history={history}>
|
|
532
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
533
|
-
<SitesList {...initialState} />
|
|
534
|
-
</ThemeProvider>
|
|
535
|
-
</Router>
|
|
536
|
-
);
|
|
537
|
-
|
|
538
|
-
await act(async () => {
|
|
539
|
-
render(Component, { store });
|
|
540
|
-
});
|
|
245
|
+
await renderSitesList();
|
|
541
246
|
|
|
542
247
|
const gridIconAction = screen.getByTestId("icon-action-Grid2");
|
|
543
248
|
const listIconAction = screen.getByTestId("icon-action-BulletList");
|
|
@@ -552,49 +257,9 @@ describe("Sites module events", () => {
|
|
|
552
257
|
});
|
|
553
258
|
|
|
554
259
|
it("should go to site on click grid site item", async () => {
|
|
555
|
-
|
|
556
|
-
const mockStore = configureStore(middlewares);
|
|
557
|
-
const store = mockStore(initialStore);
|
|
558
|
-
const setHistoryPushMock = jest.fn();
|
|
559
|
-
defaultProps.setHistoryPush = setHistoryPushMock as CalledWithMock<
|
|
560
|
-
void,
|
|
561
|
-
[path: string, isEditor?: boolean | undefined]
|
|
562
|
-
>;
|
|
563
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
564
|
-
|
|
565
|
-
// mockedAxios.mockResolvedValue(sitesResponse);
|
|
566
|
-
mockedAxios.mockImplementation((request: any) => {
|
|
567
|
-
switch (request.url) {
|
|
568
|
-
case "undefined/site/1/languages":
|
|
569
|
-
case "undefined/site/1/socials":
|
|
570
|
-
case "undefined/site/undefined/templates":
|
|
571
|
-
case "undefined/site/global/metrics":
|
|
572
|
-
case "undefined/site/1/metrics":
|
|
573
|
-
return Promise.resolve(sitesResponse);
|
|
574
|
-
case "undefined/sites?recentSitesNumber=7&pagination=true&page=1&itemsPerPage=30&order=lastAccess-desc":
|
|
575
|
-
case "undefined/site/1/data_pack/?status=activated":
|
|
576
|
-
case "undefined/site/1/structured_data":
|
|
577
|
-
return Promise.resolve(sitesResponseDataPack);
|
|
578
|
-
case "undefined/site/undefined/modules":
|
|
579
|
-
return Promise.resolve(sitesResponseCategories);
|
|
580
|
-
default:
|
|
581
|
-
return Promise.reject(new Error("not found"));
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
const Component = (
|
|
585
|
-
<Router history={history}>
|
|
586
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
587
|
-
<SitesList {...initialState} />
|
|
588
|
-
</ThemeProvider>
|
|
589
|
-
</Router>
|
|
590
|
-
);
|
|
591
|
-
|
|
592
|
-
await act(async () => {
|
|
593
|
-
render(Component, { store });
|
|
594
|
-
});
|
|
260
|
+
await renderSitesList();
|
|
595
261
|
|
|
596
262
|
const gridSiteItems = screen.getAllByTestId("grid-site-item");
|
|
597
|
-
|
|
598
263
|
expect(gridSiteItems.length).toEqual(2);
|
|
599
264
|
|
|
600
265
|
await act(async () => {
|
|
@@ -605,24 +270,9 @@ describe("Sites module events", () => {
|
|
|
605
270
|
});
|
|
606
271
|
|
|
607
272
|
it("should render site modal when clicking new button", async () => {
|
|
608
|
-
const middlewares: any = [thunk];
|
|
609
|
-
const mockStore = configureStore(middlewares);
|
|
610
|
-
const store = mockStore(initialStore);
|
|
611
|
-
|
|
612
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
613
273
|
mockedAxios.mockResolvedValue(sitesOptions);
|
|
614
274
|
|
|
615
|
-
|
|
616
|
-
<Router history={history}>
|
|
617
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
618
|
-
<SitesList {...initialState} />
|
|
619
|
-
</ThemeProvider>
|
|
620
|
-
</Router>
|
|
621
|
-
);
|
|
622
|
-
|
|
623
|
-
await act(async () => {
|
|
624
|
-
render(Component, { store });
|
|
625
|
-
});
|
|
275
|
+
await renderSitesList();
|
|
626
276
|
|
|
627
277
|
const newButton = screen.getByTestId("button-default");
|
|
628
278
|
expect(newButton.textContent).toEqual("New");
|
|
@@ -634,24 +284,7 @@ describe("Sites module events", () => {
|
|
|
634
284
|
});
|
|
635
285
|
|
|
636
286
|
it("should display filters when clicking sort items button on grid view", async () => {
|
|
637
|
-
|
|
638
|
-
const mockStore = configureStore(middlewares);
|
|
639
|
-
const store = mockStore(initialStore);
|
|
640
|
-
|
|
641
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
642
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
643
|
-
|
|
644
|
-
const Component = (
|
|
645
|
-
<Router history={history}>
|
|
646
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
647
|
-
<SitesList {...initialState} />
|
|
648
|
-
</ThemeProvider>
|
|
649
|
-
</Router>
|
|
650
|
-
);
|
|
651
|
-
|
|
652
|
-
await act(async () => {
|
|
653
|
-
render(Component, { store });
|
|
654
|
-
});
|
|
287
|
+
await renderSitesList();
|
|
655
288
|
|
|
656
289
|
const floatingMenuButton = screen.getByTestId("grid-floating-menu-button");
|
|
657
290
|
expect(floatingMenuButton).toBeTruthy();
|
|
@@ -669,24 +302,7 @@ describe("Sites module events", () => {
|
|
|
669
302
|
});
|
|
670
303
|
|
|
671
304
|
it("should render filter on grid view", async () => {
|
|
672
|
-
|
|
673
|
-
const mockStore = configureStore(middlewares);
|
|
674
|
-
const store = mockStore(initialStore);
|
|
675
|
-
|
|
676
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
677
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
678
|
-
|
|
679
|
-
const Component = (
|
|
680
|
-
<Router history={history}>
|
|
681
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
682
|
-
<SitesList {...initialState} />
|
|
683
|
-
</ThemeProvider>
|
|
684
|
-
</Router>
|
|
685
|
-
);
|
|
686
|
-
|
|
687
|
-
await act(async () => {
|
|
688
|
-
render(Component, { store });
|
|
689
|
-
});
|
|
305
|
+
await renderSitesList();
|
|
690
306
|
|
|
691
307
|
const floatingMenuButton = screen.getByTestId("grid-floating-menu-button");
|
|
692
308
|
expect(floatingMenuButton).toBeTruthy();
|
|
@@ -706,24 +322,7 @@ describe("Sites module events", () => {
|
|
|
706
322
|
});
|
|
707
323
|
|
|
708
324
|
it("should change filter's label to name when filtered by name", async () => {
|
|
709
|
-
|
|
710
|
-
const mockStore = configureStore(middlewares);
|
|
711
|
-
const store = mockStore(initialStore);
|
|
712
|
-
|
|
713
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
714
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
715
|
-
|
|
716
|
-
const Component = (
|
|
717
|
-
<Router history={history}>
|
|
718
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
719
|
-
<SitesList {...initialState} />
|
|
720
|
-
</ThemeProvider>
|
|
721
|
-
</Router>
|
|
722
|
-
);
|
|
723
|
-
|
|
724
|
-
await act(async () => {
|
|
725
|
-
render(Component, { store });
|
|
726
|
-
});
|
|
325
|
+
await renderSitesList();
|
|
727
326
|
|
|
728
327
|
const floatingMenuButton = screen.getByTestId("grid-floating-menu-button");
|
|
729
328
|
expect(floatingMenuButton).toBeTruthy();
|
|
@@ -749,23 +348,7 @@ describe("Sites module events", () => {
|
|
|
749
348
|
});
|
|
750
349
|
|
|
751
350
|
it("should change filter's label to Last access when filtered by lastAccess", async () => {
|
|
752
|
-
|
|
753
|
-
const mockStore = configureStore(middlewares);
|
|
754
|
-
const store = mockStore(initialStore);
|
|
755
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
756
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
757
|
-
|
|
758
|
-
const Component = (
|
|
759
|
-
<Router history={history}>
|
|
760
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
761
|
-
<SitesList {...initialState} />
|
|
762
|
-
</ThemeProvider>
|
|
763
|
-
</Router>
|
|
764
|
-
);
|
|
765
|
-
|
|
766
|
-
await act(async () => {
|
|
767
|
-
render(Component, { store });
|
|
768
|
-
});
|
|
351
|
+
await renderSitesList();
|
|
769
352
|
|
|
770
353
|
const floatingMenuButton = screen.getByTestId("grid-floating-menu-button");
|
|
771
354
|
expect(floatingMenuButton).toBeTruthy();
|
|
@@ -779,23 +362,7 @@ describe("Sites module events", () => {
|
|
|
779
362
|
});
|
|
780
363
|
|
|
781
364
|
it("should change filter's label to Creation Date when filtered by dateCreated", async () => {
|
|
782
|
-
|
|
783
|
-
const mockStore = configureStore(middlewares);
|
|
784
|
-
const store = mockStore(initialStore);
|
|
785
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
786
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
787
|
-
|
|
788
|
-
const Component = (
|
|
789
|
-
<Router history={history}>
|
|
790
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
791
|
-
<SitesList {...initialState} />
|
|
792
|
-
</ThemeProvider>
|
|
793
|
-
</Router>
|
|
794
|
-
);
|
|
795
|
-
|
|
796
|
-
await act(async () => {
|
|
797
|
-
render(Component, { store });
|
|
798
|
-
});
|
|
365
|
+
await renderSitesList();
|
|
799
366
|
|
|
800
367
|
const floatingMenuButton = screen.getByTestId("grid-floating-menu-button");
|
|
801
368
|
expect(floatingMenuButton).toBeTruthy();
|
|
@@ -809,23 +376,7 @@ describe("Sites module events", () => {
|
|
|
809
376
|
});
|
|
810
377
|
|
|
811
378
|
it("should open delete site modal from grid item", async () => {
|
|
812
|
-
|
|
813
|
-
const mockStore = configureStore(middlewares);
|
|
814
|
-
const store = mockStore(initialStore);
|
|
815
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
816
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
817
|
-
|
|
818
|
-
const Component = (
|
|
819
|
-
<Router history={history}>
|
|
820
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
821
|
-
<SitesList {...initialState} />
|
|
822
|
-
</ThemeProvider>
|
|
823
|
-
</Router>
|
|
824
|
-
);
|
|
825
|
-
|
|
826
|
-
await act(async () => {
|
|
827
|
-
render(Component, { store });
|
|
828
|
-
});
|
|
379
|
+
await renderSitesList();
|
|
829
380
|
|
|
830
381
|
const gridItems = screen.getAllByTestId("grid-site-item");
|
|
831
382
|
const moreInfoButton = screen.getAllByTestId("more-info-button");
|
|
@@ -841,24 +392,7 @@ describe("Sites module events", () => {
|
|
|
841
392
|
});
|
|
842
393
|
|
|
843
394
|
it("should open delete site modal from list item", async () => {
|
|
844
|
-
|
|
845
|
-
const mockStore = configureStore(middlewares);
|
|
846
|
-
const store = mockStore(initialStore);
|
|
847
|
-
|
|
848
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
849
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
850
|
-
|
|
851
|
-
const Component = (
|
|
852
|
-
<Router history={history}>
|
|
853
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
854
|
-
<SitesList {...initialState} />
|
|
855
|
-
</ThemeProvider>
|
|
856
|
-
</Router>
|
|
857
|
-
);
|
|
858
|
-
|
|
859
|
-
await act(async () => {
|
|
860
|
-
render(Component, { store });
|
|
861
|
-
});
|
|
395
|
+
await renderSitesList();
|
|
862
396
|
|
|
863
397
|
const listIconAction = screen.getByTestId("icon-action-BulletList");
|
|
864
398
|
expect(listIconAction).toBeTruthy();
|
|
@@ -879,24 +413,7 @@ describe("Sites module events", () => {
|
|
|
879
413
|
});
|
|
880
414
|
|
|
881
415
|
it("should open publish site modal from grid item", async () => {
|
|
882
|
-
|
|
883
|
-
const mockStore = configureStore(middlewares);
|
|
884
|
-
const store = mockStore(initialStore);
|
|
885
|
-
|
|
886
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
887
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
888
|
-
|
|
889
|
-
const Component = (
|
|
890
|
-
<Router history={history}>
|
|
891
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
892
|
-
<SitesList {...initialState} />
|
|
893
|
-
</ThemeProvider>
|
|
894
|
-
</Router>
|
|
895
|
-
);
|
|
896
|
-
|
|
897
|
-
await act(async () => {
|
|
898
|
-
render(Component, { store });
|
|
899
|
-
});
|
|
416
|
+
await renderSitesList();
|
|
900
417
|
|
|
901
418
|
const gridIconAction = screen.getByTestId("icon-action-Grid2");
|
|
902
419
|
fireEvent.click(gridIconAction);
|
|
@@ -914,25 +431,8 @@ describe("Sites module events", () => {
|
|
|
914
431
|
expect(publishModal).toBeTruthy();
|
|
915
432
|
});
|
|
916
433
|
|
|
917
|
-
it("should open
|
|
918
|
-
|
|
919
|
-
const mockStore = configureStore(middlewares);
|
|
920
|
-
const store = mockStore(initialStore);
|
|
921
|
-
|
|
922
|
-
mockedAxios.mockResolvedValue(sitesResponse);
|
|
923
|
-
const initialState = { ...initialStore, ...defaultProps };
|
|
924
|
-
|
|
925
|
-
const Component = (
|
|
926
|
-
<Router history={history}>
|
|
927
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
928
|
-
<SitesList {...initialState} />
|
|
929
|
-
</ThemeProvider>
|
|
930
|
-
</Router>
|
|
931
|
-
);
|
|
932
|
-
|
|
933
|
-
await act(async () => {
|
|
934
|
-
render(Component, { store });
|
|
935
|
-
});
|
|
434
|
+
it("should open publish site modal from list item", async () => {
|
|
435
|
+
await renderSitesList();
|
|
936
436
|
|
|
937
437
|
const listIconAction = screen.getByTestId("icon-action-BulletList");
|
|
938
438
|
expect(listIconAction).toBeTruthy();
|