@centreon/ui 26.12.1 → 26.12.3

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 (59) 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/Inputs/ExclusiveCheckboxGroup.browser.test.tsx +304 -0
  7. package/src/Form/Inputs/Grid.tsx +1 -2
  8. package/src/Form/Inputs/SegmentedButtons.browser.test.tsx +113 -0
  9. package/src/Form/Inputs/index.tsx +10 -52
  10. package/src/InputField/Number/Number.browser.test.tsx +109 -0
  11. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.browser.test.tsx +250 -0
  12. package/src/Listing/Listing.browser.test.tsx +476 -0
  13. package/src/Module/Module.browser.test.tsx +145 -0
  14. package/src/Pagination/Pagination.browser.test.tsx +184 -0
  15. package/src/RichTextEditor/RichTextEditor.browser.test.tsx +567 -0
  16. package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +3 -1
  17. package/src/TimePeriods/ResolutionTimePeriod.browser.test.tsx +143 -0
  18. package/src/TimePeriods/TimePeriods.browser.test.tsx +468 -0
  19. package/src/Typography/FluidTypography/FluidTypography.browser.test.tsx +54 -0
  20. package/src/api/useMutationQuery/useMutationQuery.browser.test.tsx +154 -0
  21. package/src/components/CollapsibleItem/CollapsibleItem.browser.test.tsx +120 -0
  22. package/src/components/CopyCommand/CopyCommand.browser.test.tsx +287 -0
  23. package/src/components/CrudPage/CrudPage.browser.test.tsx +659 -0
  24. package/src/components/DataTable/DataTable.browser.test.tsx +257 -0
  25. package/src/components/Form/AccessRights/AccessRights.browser.test.tsx +527 -0
  26. package/src/components/ItemComposition/ItemComposition.browser.test.tsx +172 -0
  27. package/src/components/Layout/PageLayout.browser.test.tsx +114 -0
  28. package/src/components/Modal/ConfirmationModal/ConfirmationModal.browser.test.tsx +237 -0
  29. package/src/components/SortableEntriesList/SortableEntriesList.browser.test.tsx +981 -0
  30. package/src/components/Tabs/Tabs.browser.test.tsx +115 -0
  31. package/src/utils/useFullscreen/Fullscreen.browser.test.tsx +176 -0
  32. package/src/utils/useLocale/useLocale.browser.test.tsx +49 -0
  33. package/src/utils/useLocaleTimezoneDate/{LocaleTimezoneDate.cypress.spec.tsx → LocaleTimezoneDate.browser.test.tsx} +24 -11
  34. package/src/Dashboard/Dashboard.cypress.spec.tsx +0 -71
  35. package/src/Form/Form.cypress.spec.tsx +0 -306
  36. package/src/Form/Inputs/ExclusiveCheckboxGroup.cypress.spec.tsx +0 -236
  37. package/src/Form/Inputs/SegmentedButtons.cypress.spec.tsx +0 -101
  38. package/src/InputField/Number/Number.cypress.spec.tsx +0 -89
  39. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +0 -182
  40. package/src/Listing/Listing.cypress.spec.tsx +0 -349
  41. package/src/Module/Module.cypress.spec.tsx +0 -127
  42. package/src/Pagination/Pagination.cypress.spec.tsx +0 -140
  43. package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +0 -408
  44. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +0 -74
  45. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +0 -488
  46. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +0 -27
  47. package/src/api/useMutationQuery/useMutationQuery.cypress.spec.tsx +0 -93
  48. package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +0 -76
  49. package/src/components/CopyCommand/CopyCommand.cypress.spec.tsx +0 -167
  50. package/src/components/CrudPage/CrudPage.cypress.spec.tsx +0 -561
  51. package/src/components/DataTable/DataTable.cypress.spec.tsx +0 -174
  52. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +0 -376
  53. package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +0 -112
  54. package/src/components/Layout/PageLayout.cypress.spec.tsx +0 -64
  55. package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +0 -171
  56. package/src/components/SortableEntriesList/SortableEntriesList.cypress.spec.tsx +0 -792
  57. package/src/components/Tabs/Tabs.cypress.spec.tsx +0 -69
  58. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +0 -130
  59. package/src/utils/useLocale/useLocale.cypress.spec.tsx +0 -40
@@ -1,76 +0,0 @@
1
- import { CollapsibleItem, type Props } from './CollapsibleItem';
2
-
3
- const title = 'Title';
4
-
5
- const customizedTitle = <div>Customized title</div>;
6
-
7
- const initialize = (props: Omit<Props, 'children'>): void => {
8
- cy.mount({
9
- Component: <CollapsibleItem {...props}>Content</CollapsibleItem>
10
- });
11
- };
12
-
13
- describe('CollapsibleItem', () => {
14
- it('displays the component collapsed by default', () => {
15
- initialize({ title });
16
-
17
- cy.contains(title).should('be.visible');
18
- cy.contains('Content').should('not.be.visible');
19
- cy.get('button[aria-expanded="false"]').should('exist');
20
-
21
- cy.makeSnapshot();
22
- });
23
-
24
- it('displays the component expanded when the corresponding prop is set to true', () => {
25
- initialize({ defaultExpanded: true, title });
26
-
27
- cy.contains(title).should('be.visible');
28
- cy.contains('Content').should('be.visible');
29
- cy.get('button[aria-expanded="true"]').should('exist');
30
-
31
- cy.makeSnapshot();
32
- });
33
-
34
- it('displays a customized title', () => {
35
- initialize({ title: customizedTitle });
36
-
37
- cy.contains('Customized title').should('be.visible');
38
- cy.get('button[aria-expanded="false"]').should('exist');
39
-
40
- cy.makeSnapshot();
41
- });
42
-
43
- it('displays the component as compact', () => {
44
- initialize({ compact: true, title });
45
-
46
- cy.contains(title).should('be.visible');
47
- cy.get('button[aria-expanded="false"]').should('exist');
48
- cy.get('div[data-compact="true"]').should('exist');
49
-
50
- cy.makeSnapshot();
51
- });
52
-
53
- it('displays the component as compact and expanded when the icon is clicked', () => {
54
- initialize({ compact: true, title });
55
-
56
- cy.contains(title).should('be.visible');
57
- cy.get('button[aria-expanded="false"]').should('exist');
58
-
59
- cy.get('button[aria-expanded="false"]').click();
60
-
61
- cy.get('button[aria-expanded="true"]').should('exist');
62
- cy.contains('Content').should('be.visible');
63
-
64
- cy.makeSnapshot();
65
- });
66
-
67
- it('displays the component as compact and a customized title', () => {
68
- initialize({ compact: true, title: customizedTitle });
69
-
70
- cy.contains('Customized title').should('be.visible');
71
- cy.get('button[aria-expanded="false"]').should('exist');
72
- cy.get('div[data-compact="true"]').should('exist');
73
-
74
- cy.makeSnapshot();
75
- });
76
- });
@@ -1,167 +0,0 @@
1
- import { ThemeMode, userAtom } from '@centreon/ui-context';
2
-
3
- import { createStore, Provider } from 'jotai';
4
-
5
- import SnackbarProvider from '../../Snackbar/SnackbarProvider';
6
- import ThemeProvider from '../../ThemeProvider';
7
- import CopyCommand, { type CopyCommandProps } from './CopyCommand';
8
-
9
- const initialize = (props: CopyCommandProps & { theme?: ThemeMode }): void => {
10
- const store = createStore();
11
- store.set(userAtom, { themeMode: props.theme || ThemeMode.light });
12
- cy.mount({
13
- Component: (
14
- <Provider store={store}>
15
- <ThemeProvider>
16
- <SnackbarProvider>
17
- <CopyCommand {...props} />
18
- </SnackbarProvider>
19
- </ThemeProvider>
20
- </Provider>
21
- )
22
- });
23
- };
24
-
25
- describe('CopyCommand', () => {
26
- it('displays bash code when props are set', () => {
27
- initialize({
28
- commandToCopy: 'echo "hello" | grep "hel"',
29
- language: 'bash',
30
- text: `# a simple command
31
- echo "hello" | grep "hel"`
32
- });
33
-
34
- cy.contains('# a simple command').should('be.visible');
35
- cy.contains('echo').should('be.visible');
36
- cy.contains('bash').should('be.visible');
37
- cy.findByTestId('Copy command').should('be.visible');
38
-
39
- cy.makeSnapshot();
40
- });
41
-
42
- it('displays yaml code when props are set', () => {
43
- initialize({
44
- commandToCopy: 'echo "hello" | grep "hel"',
45
- language: 'yaml',
46
- text: `key:
47
- with:
48
- input: "input"`
49
- });
50
-
51
- cy.contains('key').should('be.visible');
52
- cy.contains('"input"').should('be.visible');
53
- cy.contains('yaml').should('be.visible');
54
-
55
- cy.makeSnapshot();
56
- });
57
-
58
- it('displays php code when props are set', () => {
59
- initialize({
60
- commandToCopy: 'echo "hello" | grep "hel"',
61
- language: 'php',
62
- text: `<?php
63
- echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!';
64
- ?>`
65
- });
66
-
67
- cy.contains('echo').should('be.visible');
68
- cy.contains('"name"').should('be.visible');
69
- cy.contains('php').should('be.visible');
70
-
71
- cy.makeSnapshot();
72
- });
73
-
74
- it('displays json code when props are set', () => {
75
- initialize({
76
- commandToCopy: 'echo "hello" | grep "hel"',
77
- language: 'json',
78
- text: `{
79
- "number": 1,
80
- "boolean": true,
81
- "array": [
82
- {
83
- "string": "text"
84
- }
85
- ]
86
- }`
87
- });
88
-
89
- cy.contains('"number"').should('be.visible');
90
- cy.contains('true').should('be.visible');
91
- cy.contains('json').should('be.visible');
92
-
93
- cy.makeSnapshot();
94
- });
95
-
96
- it('does not display the copy button when the corresponding prop is not passed', () => {
97
- initialize({
98
- language: 'json',
99
- text: `{
100
- "number": 1,
101
- "boolean": true,
102
- "array": [
103
- {
104
- "string": "text"
105
- }
106
- ]
107
- }`
108
- });
109
-
110
- cy.findByTestId('Copy command').should('not.exist');
111
-
112
- cy.makeSnapshot();
113
- });
114
-
115
- it('displays the highlighted code in dark mode when the theme is changed', () => {
116
- initialize({
117
- language: 'json',
118
- text: `{
119
- "number": 1,
120
- "boolean": true,
121
- "array": [
122
- {
123
- "string": "text"
124
- }
125
- ]
126
- }`,
127
- theme: ThemeMode.dark
128
- });
129
-
130
- cy.get('.hljs-keyword').should('have.css', 'color', 'rgb(255, 123, 114)');
131
-
132
- cy.makeSnapshot();
133
- });
134
-
135
- it('copies the command to the clipboard when the button is clicked', () => {
136
- cy.wrap(
137
- Cypress.automation('remote:debugger:protocol', {
138
- command: 'Browser.grantPermissions',
139
- params: {
140
- origin: window.location.origin,
141
- permissions: ['clipboardReadWrite', 'clipboardSanitizedWrite']
142
- }
143
- })
144
- );
145
- cy.window()
146
- .its('navigator.clipboard')
147
- .then((clipboard) => {
148
- cy.spy(clipboard, 'writeText').as('writeText');
149
- });
150
-
151
- initialize({
152
- commandToCopy: 'echo "hello" | grep "hel"',
153
- language: 'bash',
154
- text: `# a simple command
155
- echo "hello" | grep "hel"`
156
- });
157
-
158
- cy.findByTestId('Copy command').click();
159
-
160
- cy.get('@writeText').should(
161
- 'have.been.calledOnceWith',
162
- 'echo "hello" | grep "hel"'
163
- );
164
-
165
- cy.makeSnapshot();
166
- });
167
- });