@centreon/ui 26.12.1 → 26.12.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/package.json +6 -3
- package/public/mockServiceWorker.js +31 -8
- package/src/Dashboard/Dashboard.browser.test.tsx +107 -0
- package/src/Form/Form.browser.test.tsx +445 -0
- package/src/Form/Inputs/ExclusiveCheckboxGroup.browser.test.tsx +304 -0
- package/src/Form/Inputs/SegmentedButtons.browser.test.tsx +113 -0
- package/src/InputField/Number/Number.browser.test.tsx +109 -0
- package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.browser.test.tsx +250 -0
- package/src/Listing/Listing.browser.test.tsx +476 -0
- package/src/Module/Module.browser.test.tsx +145 -0
- package/src/Pagination/Pagination.browser.test.tsx +184 -0
- package/src/RichTextEditor/RichTextEditor.browser.test.tsx +567 -0
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +3 -1
- package/src/TimePeriods/ResolutionTimePeriod.browser.test.tsx +143 -0
- package/src/TimePeriods/TimePeriods.browser.test.tsx +468 -0
- package/src/Typography/FluidTypography/FluidTypography.browser.test.tsx +54 -0
- package/src/api/useMutationQuery/useMutationQuery.browser.test.tsx +154 -0
- package/src/components/CollapsibleItem/CollapsibleItem.browser.test.tsx +120 -0
- package/src/components/CopyCommand/CopyCommand.browser.test.tsx +287 -0
- package/src/components/CrudPage/CrudPage.browser.test.tsx +659 -0
- package/src/components/DataTable/DataTable.browser.test.tsx +257 -0
- package/src/components/Form/AccessRights/AccessRights.browser.test.tsx +527 -0
- package/src/components/ItemComposition/ItemComposition.browser.test.tsx +172 -0
- package/src/components/Layout/PageLayout.browser.test.tsx +114 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.browser.test.tsx +237 -0
- package/src/components/SortableEntriesList/SortableEntriesList.browser.test.tsx +981 -0
- package/src/components/Tabs/Tabs.browser.test.tsx +115 -0
- package/src/utils/useFullscreen/Fullscreen.browser.test.tsx +176 -0
- package/src/utils/useLocale/useLocale.browser.test.tsx +49 -0
- package/src/utils/useLocaleTimezoneDate/{LocaleTimezoneDate.cypress.spec.tsx → LocaleTimezoneDate.browser.test.tsx} +24 -11
- package/src/Dashboard/Dashboard.cypress.spec.tsx +0 -71
- package/src/Form/Form.cypress.spec.tsx +0 -306
- package/src/Form/Inputs/ExclusiveCheckboxGroup.cypress.spec.tsx +0 -236
- package/src/Form/Inputs/SegmentedButtons.cypress.spec.tsx +0 -101
- package/src/InputField/Number/Number.cypress.spec.tsx +0 -89
- package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +0 -182
- package/src/Listing/Listing.cypress.spec.tsx +0 -349
- package/src/Module/Module.cypress.spec.tsx +0 -127
- package/src/Pagination/Pagination.cypress.spec.tsx +0 -140
- package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +0 -408
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +0 -74
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +0 -488
- package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +0 -27
- package/src/api/useMutationQuery/useMutationQuery.cypress.spec.tsx +0 -93
- package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +0 -76
- package/src/components/CopyCommand/CopyCommand.cypress.spec.tsx +0 -167
- package/src/components/CrudPage/CrudPage.cypress.spec.tsx +0 -561
- package/src/components/DataTable/DataTable.cypress.spec.tsx +0 -174
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +0 -376
- package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +0 -112
- package/src/components/Layout/PageLayout.cypress.spec.tsx +0 -64
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +0 -171
- package/src/components/SortableEntriesList/SortableEntriesList.cypress.spec.tsx +0 -792
- package/src/components/Tabs/Tabs.cypress.spec.tsx +0 -69
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +0 -130
- package/src/utils/useLocale/useLocale.cypress.spec.tsx +0 -40
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { T } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import { PageHeader } from '..';
|
|
4
|
-
import { PageLayout } from '.';
|
|
5
|
-
import { AreaIndicator } from './AreaIndicator';
|
|
6
|
-
|
|
7
|
-
const initialize = (): void => {
|
|
8
|
-
cy.mount({
|
|
9
|
-
Component: (
|
|
10
|
-
<PageLayout>
|
|
11
|
-
<PageLayout.Header>
|
|
12
|
-
<PageHeader>
|
|
13
|
-
<PageHeader.Menu>
|
|
14
|
-
<PageLayout.QuickAccess
|
|
15
|
-
create={cy.stub()}
|
|
16
|
-
elements={[
|
|
17
|
-
{
|
|
18
|
-
id: 1,
|
|
19
|
-
name: 'Entity'
|
|
20
|
-
}
|
|
21
|
-
]}
|
|
22
|
-
goBack={cy.stub()}
|
|
23
|
-
isActive={T}
|
|
24
|
-
labels={{
|
|
25
|
-
create: 'Create',
|
|
26
|
-
goBack: 'Go back'
|
|
27
|
-
}}
|
|
28
|
-
navigateToElement={cy.stub()}
|
|
29
|
-
/>
|
|
30
|
-
</PageHeader.Menu>
|
|
31
|
-
<PageHeader.Main>
|
|
32
|
-
<PageHeader.Title description="Description" title="Title" />
|
|
33
|
-
</PageHeader.Main>
|
|
34
|
-
<PageHeader.Actions>Actions</PageHeader.Actions>
|
|
35
|
-
</PageHeader>
|
|
36
|
-
</PageLayout.Header>
|
|
37
|
-
<PageLayout.Body>
|
|
38
|
-
<PageLayout.Actions>
|
|
39
|
-
<AreaIndicator name="Body actions" />
|
|
40
|
-
</PageLayout.Actions>
|
|
41
|
-
<h1>Content</h1>
|
|
42
|
-
</PageLayout.Body>
|
|
43
|
-
</PageLayout>
|
|
44
|
-
)
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
describe('Page layout', () => {
|
|
49
|
-
beforeEach(initialize);
|
|
50
|
-
|
|
51
|
-
it('displays the page layout', () => {
|
|
52
|
-
cy.makeSnapshot();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('opens the quick access poppin when the corresponding logo is displayed', () => {
|
|
56
|
-
cy.findByTestId('quickaccess').click();
|
|
57
|
-
|
|
58
|
-
cy.contains('Entity').should('be.visible');
|
|
59
|
-
cy.contains('Create').should('be.visible');
|
|
60
|
-
cy.contains('Go back').should('be.visible');
|
|
61
|
-
|
|
62
|
-
cy.makeSnapshot();
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { Button } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
import { atom, createStore, Provider, useSetAtom } from 'jotai';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
ConfirmationModal,
|
|
7
|
-
type ConfirmationModalProps
|
|
8
|
-
} from './ConfirmationModal';
|
|
9
|
-
|
|
10
|
-
const testAtom = atom<string | null>(null);
|
|
11
|
-
|
|
12
|
-
const buttonLabel = 'Click to open modal';
|
|
13
|
-
|
|
14
|
-
const TestComponent = (args: ConfirmationModalProps<string>): JSX.Element => {
|
|
15
|
-
const setAtom = useSetAtom(testAtom);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
<Button onClick={() => setAtom('John')}>{buttonLabel}</Button>
|
|
20
|
-
<ConfirmationModal<string> {...args} />
|
|
21
|
-
</>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const staticLabels = {
|
|
26
|
-
cancel: 'Cancel',
|
|
27
|
-
confirm: 'Confirm',
|
|
28
|
-
description: 'Description',
|
|
29
|
-
title: 'Title'
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const dynamicLabels = {
|
|
33
|
-
cancel: 'Cancel',
|
|
34
|
-
confirm: 'Confirm',
|
|
35
|
-
description: (data) => `Description ${data}`,
|
|
36
|
-
title: (data) => `Hello ${data}`
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const initialize = (
|
|
40
|
-
props: Pick<
|
|
41
|
-
ConfirmationModalProps<string>,
|
|
42
|
-
'labels' | 'disabled' | 'hasCloseButton' | 'isDanger'
|
|
43
|
-
>
|
|
44
|
-
): { cancel; confirm } => {
|
|
45
|
-
const store = createStore();
|
|
46
|
-
|
|
47
|
-
const cancel = cy.stub();
|
|
48
|
-
const confirm = cy.stub();
|
|
49
|
-
|
|
50
|
-
cy.mount({
|
|
51
|
-
Component: (
|
|
52
|
-
<Provider store={store}>
|
|
53
|
-
<TestComponent
|
|
54
|
-
{...props}
|
|
55
|
-
atom={testAtom}
|
|
56
|
-
onCancel={cancel}
|
|
57
|
-
onConfirm={confirm}
|
|
58
|
-
/>
|
|
59
|
-
</Provider>
|
|
60
|
-
)
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
cancel,
|
|
65
|
-
confirm
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
describe('Confirmation modal', () => {
|
|
70
|
-
it('displays the modal with static labels', () => {
|
|
71
|
-
initialize({ labels: staticLabels });
|
|
72
|
-
|
|
73
|
-
cy.contains(buttonLabel).click();
|
|
74
|
-
|
|
75
|
-
cy.contains('Title').should('be.visible');
|
|
76
|
-
cy.contains('Description').should('be.visible');
|
|
77
|
-
cy.findByLabelText('close').should('be.visible');
|
|
78
|
-
|
|
79
|
-
cy.makeSnapshot();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('displays the modal with dynamic labels', () => {
|
|
83
|
-
initialize({ labels: dynamicLabels });
|
|
84
|
-
|
|
85
|
-
cy.contains(buttonLabel).click();
|
|
86
|
-
|
|
87
|
-
cy.contains('Hello John').should('be.visible');
|
|
88
|
-
cy.contains('Description John').should('be.visible');
|
|
89
|
-
|
|
90
|
-
cy.makeSnapshot();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('displays the confirm button as disabled when a prop is set', () => {
|
|
94
|
-
initialize({ disabled: true, labels: staticLabels });
|
|
95
|
-
|
|
96
|
-
cy.contains(buttonLabel).click();
|
|
97
|
-
|
|
98
|
-
cy.contains('Confirm').should('be.disabled');
|
|
99
|
-
|
|
100
|
-
cy.makeSnapshot();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('displays the confirm button as danger when a prop is set', () => {
|
|
104
|
-
initialize({ isDanger: true, labels: staticLabels });
|
|
105
|
-
|
|
106
|
-
cy.contains(buttonLabel).click();
|
|
107
|
-
|
|
108
|
-
cy.contains('Confirm').should('have.attr', 'data-is-danger', 'true');
|
|
109
|
-
|
|
110
|
-
cy.makeSnapshot();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('displays the modal without the close button when a prop is set', () => {
|
|
114
|
-
initialize({ hasCloseButton: false, labels: staticLabels });
|
|
115
|
-
|
|
116
|
-
cy.contains(buttonLabel).click();
|
|
117
|
-
|
|
118
|
-
cy.findByLabelText('close').should('not.exist');
|
|
119
|
-
|
|
120
|
-
cy.makeSnapshot();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('closes the modal when the close button is clicked', () => {
|
|
124
|
-
initialize({ labels: staticLabels });
|
|
125
|
-
|
|
126
|
-
cy.contains(buttonLabel).click();
|
|
127
|
-
|
|
128
|
-
cy.contains('Title').should('be.visible');
|
|
129
|
-
|
|
130
|
-
cy.findByLabelText('close').click();
|
|
131
|
-
|
|
132
|
-
cy.contains('Title').should('not.exist');
|
|
133
|
-
|
|
134
|
-
cy.makeSnapshot();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('closes the modal when the cancel button is clicked', () => {
|
|
138
|
-
const { cancel } = initialize({ labels: staticLabels });
|
|
139
|
-
|
|
140
|
-
cy.contains(buttonLabel).click();
|
|
141
|
-
|
|
142
|
-
cy.contains('Title').should('be.visible');
|
|
143
|
-
|
|
144
|
-
cy.contains('Cancel')
|
|
145
|
-
.click()
|
|
146
|
-
.then(() => {
|
|
147
|
-
expect(cancel).to.be.calledWith('John');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
cy.contains('Title').should('not.exist');
|
|
151
|
-
|
|
152
|
-
cy.makeSnapshot();
|
|
153
|
-
});
|
|
154
|
-
it('closes the modal when the confirm button is clicked', () => {
|
|
155
|
-
const { confirm } = initialize({ labels: staticLabels });
|
|
156
|
-
|
|
157
|
-
cy.contains(buttonLabel).click();
|
|
158
|
-
|
|
159
|
-
cy.contains('Title').should('be.visible');
|
|
160
|
-
|
|
161
|
-
cy.contains('Confirm')
|
|
162
|
-
.click()
|
|
163
|
-
.then(() => {
|
|
164
|
-
expect(confirm).to.be.calledWith('John');
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
cy.contains('Title').should('not.exist');
|
|
168
|
-
|
|
169
|
-
cy.makeSnapshot();
|
|
170
|
-
});
|
|
171
|
-
});
|