@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.
- package/package.json +6 -3
- package/public/mockServiceWorker.js +31 -8
- package/src/Dashboard/Dashboard.browser.test.tsx +107 -0
- package/src/Form/CollapsibleGroup.tsx +6 -33
- package/src/Form/Form.browser.test.tsx +553 -0
- package/src/Form/Form.stories.tsx +102 -1
- package/src/Form/Form.tsx +4 -3
- package/src/Form/Inputs/ExclusiveCheckboxGroup.browser.test.tsx +304 -0
- package/src/Form/Inputs/Grid.browser.test.tsx +186 -0
- package/src/Form/Inputs/Grid.tsx +59 -12
- package/src/Form/Inputs/PasswordInput.browser.test.tsx +80 -0
- package/src/Form/Inputs/SegmentedButtons.browser.test.tsx +197 -0
- package/src/Form/Inputs/SegmentedButtons.tsx +38 -29
- package/src/Form/Inputs/Text.tsx +13 -1
- package/src/Form/Inputs/index.tsx +10 -52
- package/src/Form/Inputs/models.ts +6 -0
- package/src/Form/Section/FormSection.browser.test.tsx +174 -0
- package/src/Form/Section/FormSection.tsx +20 -6
- package/src/Form/Section/navigateToSection.ts +26 -8
- package/src/Form/Section/useActiveSection.ts +213 -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/InputField/Select/Autocomplete/Connected/index.test.tsx +37 -0
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +56 -45
- package/src/Listing/Cell/DataCell.tsx +0 -2
- 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/Header/PageHeader/PageHeader.stories.tsx +9 -0
- package/src/components/Header/PageHeader/PageHeaderMain.tsx +4 -2
- package/src/components/Header/PageHeader/PageHeaderTitle.tsx +61 -18
- 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/components/Tabs/Tabs.tsx +7 -1
- 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 -304
- 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,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
|
-
});
|