@centreon/ui 26.10.8 → 26.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/package.json +6 -3
  2. package/public/mockServiceWorker.js +31 -8
  3. package/src/Dashboard/Dashboard.browser.test.tsx +107 -0
  4. package/src/Form/CollapsibleGroup.tsx +6 -33
  5. package/src/Form/Form.browser.test.tsx +553 -0
  6. package/src/Form/Form.stories.tsx +102 -1
  7. package/src/Form/Form.tsx +4 -3
  8. package/src/Form/Inputs/ExclusiveCheckboxGroup.browser.test.tsx +304 -0
  9. package/src/Form/Inputs/Grid.browser.test.tsx +186 -0
  10. package/src/Form/Inputs/Grid.tsx +59 -12
  11. package/src/Form/Inputs/PasswordInput.browser.test.tsx +80 -0
  12. package/src/Form/Inputs/SegmentedButtons.browser.test.tsx +197 -0
  13. package/src/Form/Inputs/SegmentedButtons.tsx +38 -29
  14. package/src/Form/Inputs/Text.tsx +13 -1
  15. package/src/Form/Inputs/index.tsx +10 -52
  16. package/src/Form/Inputs/models.ts +6 -0
  17. package/src/Form/Section/FormSection.browser.test.tsx +174 -0
  18. package/src/Form/Section/FormSection.tsx +20 -6
  19. package/src/Form/Section/navigateToSection.ts +26 -8
  20. package/src/Form/Section/useActiveSection.ts +213 -0
  21. package/src/InputField/Number/Number.browser.test.tsx +109 -0
  22. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.browser.test.tsx +250 -0
  23. package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +37 -0
  24. package/src/InputField/Select/Autocomplete/Connected/index.tsx +56 -45
  25. package/src/Listing/Cell/DataCell.tsx +0 -2
  26. package/src/Listing/Listing.browser.test.tsx +476 -0
  27. package/src/Module/Module.browser.test.tsx +145 -0
  28. package/src/Pagination/Pagination.browser.test.tsx +184 -0
  29. package/src/RichTextEditor/RichTextEditor.browser.test.tsx +567 -0
  30. package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +3 -1
  31. package/src/TimePeriods/ResolutionTimePeriod.browser.test.tsx +143 -0
  32. package/src/TimePeriods/TimePeriods.browser.test.tsx +468 -0
  33. package/src/Typography/FluidTypography/FluidTypography.browser.test.tsx +54 -0
  34. package/src/api/useMutationQuery/useMutationQuery.browser.test.tsx +154 -0
  35. package/src/components/CollapsibleItem/CollapsibleItem.browser.test.tsx +120 -0
  36. package/src/components/CopyCommand/CopyCommand.browser.test.tsx +287 -0
  37. package/src/components/CrudPage/CrudPage.browser.test.tsx +659 -0
  38. package/src/components/DataTable/DataTable.browser.test.tsx +257 -0
  39. package/src/components/Form/AccessRights/AccessRights.browser.test.tsx +527 -0
  40. package/src/components/Header/PageHeader/PageHeader.stories.tsx +9 -0
  41. package/src/components/Header/PageHeader/PageHeaderMain.tsx +4 -2
  42. package/src/components/Header/PageHeader/PageHeaderTitle.tsx +61 -18
  43. package/src/components/ItemComposition/ItemComposition.browser.test.tsx +172 -0
  44. package/src/components/Layout/PageLayout.browser.test.tsx +114 -0
  45. package/src/components/Modal/ConfirmationModal/ConfirmationModal.browser.test.tsx +237 -0
  46. package/src/components/SortableEntriesList/SortableEntriesList.browser.test.tsx +981 -0
  47. package/src/components/Tabs/Tabs.browser.test.tsx +115 -0
  48. package/src/components/Tabs/Tabs.tsx +7 -1
  49. package/src/utils/useFullscreen/Fullscreen.browser.test.tsx +176 -0
  50. package/src/utils/useLocale/useLocale.browser.test.tsx +49 -0
  51. package/src/utils/useLocaleTimezoneDate/{LocaleTimezoneDate.cypress.spec.tsx → LocaleTimezoneDate.browser.test.tsx} +24 -11
  52. package/src/Dashboard/Dashboard.cypress.spec.tsx +0 -71
  53. package/src/Form/Form.cypress.spec.tsx +0 -306
  54. package/src/Form/Inputs/ExclusiveCheckboxGroup.cypress.spec.tsx +0 -236
  55. package/src/Form/Inputs/SegmentedButtons.cypress.spec.tsx +0 -101
  56. package/src/InputField/Number/Number.cypress.spec.tsx +0 -89
  57. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +0 -182
  58. package/src/Listing/Listing.cypress.spec.tsx +0 -304
  59. package/src/Module/Module.cypress.spec.tsx +0 -127
  60. package/src/Pagination/Pagination.cypress.spec.tsx +0 -140
  61. package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +0 -408
  62. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +0 -74
  63. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +0 -488
  64. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +0 -27
  65. package/src/api/useMutationQuery/useMutationQuery.cypress.spec.tsx +0 -93
  66. package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +0 -76
  67. package/src/components/CopyCommand/CopyCommand.cypress.spec.tsx +0 -167
  68. package/src/components/CrudPage/CrudPage.cypress.spec.tsx +0 -561
  69. package/src/components/DataTable/DataTable.cypress.spec.tsx +0 -174
  70. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +0 -376
  71. package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +0 -112
  72. package/src/components/Layout/PageLayout.cypress.spec.tsx +0 -64
  73. package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +0 -171
  74. package/src/components/SortableEntriesList/SortableEntriesList.cypress.spec.tsx +0 -792
  75. package/src/components/Tabs/Tabs.cypress.spec.tsx +0 -69
  76. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +0 -130
  77. 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
- });