@centreon/ui 26.10.7 → 26.10.9

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 (64) 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/Form.browser.test.tsx +445 -0
  5. package/src/Form/Inputs/ConnectedAutocomplete.tsx +12 -4
  6. package/src/Form/Inputs/ExclusiveCheckboxGroup.browser.test.tsx +304 -0
  7. package/src/Form/Inputs/ExclusiveCheckboxGroup.tsx +60 -15
  8. package/src/Form/Inputs/LoadingSkeleton.tsx +4 -0
  9. package/src/Form/Inputs/SegmentedButtons.browser.test.tsx +113 -0
  10. package/src/Form/Inputs/SegmentedButtons.tsx +71 -0
  11. package/src/Form/Inputs/index.tsx +5 -0
  12. package/src/Form/Inputs/models.ts +16 -1
  13. package/src/InputField/Number/Number.browser.test.tsx +109 -0
  14. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.browser.test.tsx +250 -0
  15. package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +37 -0
  16. package/src/InputField/Select/Autocomplete/Connected/index.tsx +59 -45
  17. package/src/Listing/Cell/DataCell.tsx +0 -2
  18. package/src/Listing/Listing.browser.test.tsx +476 -0
  19. package/src/Module/Module.browser.test.tsx +145 -0
  20. package/src/Pagination/Pagination.browser.test.tsx +184 -0
  21. package/src/RichTextEditor/RichTextEditor.browser.test.tsx +567 -0
  22. package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +3 -1
  23. package/src/TimePeriods/ResolutionTimePeriod.browser.test.tsx +143 -0
  24. package/src/TimePeriods/TimePeriods.browser.test.tsx +468 -0
  25. package/src/Typography/FluidTypography/FluidTypography.browser.test.tsx +54 -0
  26. package/src/api/useMutationQuery/useMutationQuery.browser.test.tsx +154 -0
  27. package/src/components/CollapsibleItem/CollapsibleItem.browser.test.tsx +120 -0
  28. package/src/components/CopyCommand/CopyCommand.browser.test.tsx +287 -0
  29. package/src/components/CrudPage/CrudPage.browser.test.tsx +659 -0
  30. package/src/components/DataTable/DataTable.browser.test.tsx +257 -0
  31. package/src/components/Form/AccessRights/AccessRights.browser.test.tsx +527 -0
  32. package/src/components/ItemComposition/ItemComposition.browser.test.tsx +172 -0
  33. package/src/components/Layout/PageLayout.browser.test.tsx +114 -0
  34. package/src/components/Modal/ConfirmationModal/ConfirmationModal.browser.test.tsx +237 -0
  35. package/src/components/SortableEntriesList/SortableEntriesList.browser.test.tsx +981 -0
  36. package/src/components/Tabs/Tabs.browser.test.tsx +115 -0
  37. package/src/utils/useFullscreen/Fullscreen.browser.test.tsx +176 -0
  38. package/src/utils/useLocale/useLocale.browser.test.tsx +49 -0
  39. package/src/utils/useLocaleTimezoneDate/{LocaleTimezoneDate.cypress.spec.tsx → LocaleTimezoneDate.browser.test.tsx} +24 -11
  40. package/src/Dashboard/Dashboard.cypress.spec.tsx +0 -71
  41. package/src/Form/Form.cypress.spec.tsx +0 -306
  42. package/src/Form/Inputs/ExclusiveCheckboxGroup.cypress.spec.tsx +0 -174
  43. package/src/InputField/Number/Number.cypress.spec.tsx +0 -89
  44. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +0 -182
  45. package/src/Listing/Listing.cypress.spec.tsx +0 -304
  46. package/src/Module/Module.cypress.spec.tsx +0 -127
  47. package/src/Pagination/Pagination.cypress.spec.tsx +0 -140
  48. package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +0 -408
  49. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +0 -74
  50. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +0 -488
  51. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +0 -27
  52. package/src/api/useMutationQuery/useMutationQuery.cypress.spec.tsx +0 -93
  53. package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +0 -76
  54. package/src/components/CopyCommand/CopyCommand.cypress.spec.tsx +0 -167
  55. package/src/components/CrudPage/CrudPage.cypress.spec.tsx +0 -561
  56. package/src/components/DataTable/DataTable.cypress.spec.tsx +0 -174
  57. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +0 -376
  58. package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +0 -112
  59. package/src/components/Layout/PageLayout.cypress.spec.tsx +0 -64
  60. package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +0 -171
  61. package/src/components/SortableEntriesList/SortableEntriesList.cypress.spec.tsx +0 -792
  62. package/src/components/Tabs/Tabs.cypress.spec.tsx +0 -69
  63. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +0 -130
  64. package/src/utils/useLocale/useLocale.cypress.spec.tsx +0 -40
@@ -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
- });