@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.
- 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/Inputs/ExclusiveCheckboxGroup.browser.test.tsx +304 -0
- package/src/Form/Inputs/Grid.tsx +1 -2
- package/src/Form/Inputs/SegmentedButtons.browser.test.tsx +113 -0
- package/src/Form/Inputs/index.tsx +10 -52
- 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,69 +0,0 @@
|
|
|
1
|
-
import { Typography } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
import { Tabs } from '.';
|
|
4
|
-
import { TabPanel } from './TabPanel';
|
|
5
|
-
|
|
6
|
-
const initialize = (withTabListProps = false): void => {
|
|
7
|
-
cy.mount({
|
|
8
|
-
Component: (
|
|
9
|
-
<Tabs
|
|
10
|
-
defaultTab="tab 0"
|
|
11
|
-
tabList={
|
|
12
|
-
withTabListProps
|
|
13
|
-
? {
|
|
14
|
-
variant: 'fullWidth'
|
|
15
|
-
}
|
|
16
|
-
: undefined
|
|
17
|
-
}
|
|
18
|
-
tabs={[
|
|
19
|
-
{ label: 'Tab 0', value: 'tab 0' },
|
|
20
|
-
{ label: 'Tab 1', value: 'tab 1' }
|
|
21
|
-
]}
|
|
22
|
-
>
|
|
23
|
-
<TabPanel value="tab 0">
|
|
24
|
-
<Typography>Tab 0</Typography>
|
|
25
|
-
</TabPanel>
|
|
26
|
-
<TabPanel value="tab 1">
|
|
27
|
-
<Typography>Tab 1</Typography>
|
|
28
|
-
</TabPanel>
|
|
29
|
-
</Tabs>
|
|
30
|
-
)
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
describe('Tabs', () => {
|
|
35
|
-
it('displays tabs and their content when a tab is selected', () => {
|
|
36
|
-
initialize();
|
|
37
|
-
|
|
38
|
-
cy.get('[data-TabPanel="tab 0"]').should('not.have.attr', 'hidden');
|
|
39
|
-
cy.get('[data-TabPanel="tab 1"]').should('have.attr', 'hidden');
|
|
40
|
-
cy.findByLabelText('Tab 0')
|
|
41
|
-
.should('have.attr', 'aria-selected')
|
|
42
|
-
.and('equals', 'true');
|
|
43
|
-
cy.findByLabelText('Tab 1')
|
|
44
|
-
.should('have.attr', 'aria-selected')
|
|
45
|
-
.and('equals', 'false');
|
|
46
|
-
|
|
47
|
-
cy.contains('Tab 1').click();
|
|
48
|
-
|
|
49
|
-
cy.get('[data-TabPanel="tab 0"]').should('have.attr', 'hidden');
|
|
50
|
-
cy.get('[data-TabPanel="tab 1"]').should('not.have.attr', 'hidden');
|
|
51
|
-
cy.findByLabelText('Tab 0')
|
|
52
|
-
.should('have.attr', 'aria-selected')
|
|
53
|
-
.and('equals', 'false');
|
|
54
|
-
cy.findByLabelText('Tab 1')
|
|
55
|
-
.should('have.attr', 'aria-selected')
|
|
56
|
-
.and('equals', 'true');
|
|
57
|
-
|
|
58
|
-
cy.makeSnapshot();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('displays tabs when tabList props are set', () => {
|
|
62
|
-
initialize(true);
|
|
63
|
-
|
|
64
|
-
cy.get('[data-TabPanel="tab 0"]').should('not.have.attr', 'hidden');
|
|
65
|
-
cy.get('[data-TabPanel="tab 1"]').should('have.attr', 'hidden');
|
|
66
|
-
|
|
67
|
-
cy.makeSnapshot();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { Button } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
import { createStore, Provider } from 'jotai';
|
|
4
|
-
import { BrowserRouter } from 'react-router';
|
|
5
|
-
|
|
6
|
-
import { useFullscreen } from './useFullscreen';
|
|
7
|
-
import { router, useFullscreenListener } from './useFullscreenListener';
|
|
8
|
-
|
|
9
|
-
const labelEnterFullscreen = 'Enter fullscreen';
|
|
10
|
-
const labelExitFullscreen = 'Exit fullscreen';
|
|
11
|
-
|
|
12
|
-
const ChildComponent = (): JSX.Element => {
|
|
13
|
-
const { toggleFullscreen, fullscreenEnabled, isFullscreenActivated } =
|
|
14
|
-
useFullscreen();
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div
|
|
18
|
-
data-fullscreenActivated={isFullscreenActivated}
|
|
19
|
-
data-fullscreenEnabled={fullscreenEnabled}
|
|
20
|
-
id="test"
|
|
21
|
-
>
|
|
22
|
-
<Button onClick={() => toggleFullscreen(document.body)}>
|
|
23
|
-
{isFullscreenActivated ? labelExitFullscreen : labelEnterFullscreen}
|
|
24
|
-
</Button>
|
|
25
|
-
<input id="input" />
|
|
26
|
-
<textarea id="textarea" />
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const TestComponent = (): JSX.Element => {
|
|
32
|
-
useFullscreenListener();
|
|
33
|
-
|
|
34
|
-
return <ChildComponent />;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const initialize = (): void => {
|
|
38
|
-
const store = createStore();
|
|
39
|
-
|
|
40
|
-
const queryParameters = new Map();
|
|
41
|
-
|
|
42
|
-
cy.stub(router, 'useSearchParams', () => queryParameters);
|
|
43
|
-
|
|
44
|
-
cy.mount({
|
|
45
|
-
Component: (
|
|
46
|
-
<BrowserRouter>
|
|
47
|
-
<Provider store={store}>
|
|
48
|
-
<TestComponent />
|
|
49
|
-
</Provider>
|
|
50
|
-
</BrowserRouter>
|
|
51
|
-
)
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
describe('Fullscreen', () => {
|
|
56
|
-
it('enters fullscreen mode when the button is clicked', () => {
|
|
57
|
-
initialize();
|
|
58
|
-
|
|
59
|
-
cy.get('#test')
|
|
60
|
-
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
61
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
62
|
-
|
|
63
|
-
cy.contains(labelEnterFullscreen).realClick();
|
|
64
|
-
|
|
65
|
-
cy.get('#test')
|
|
66
|
-
.should('have.attr', 'data-fullscreenActivated', 'true')
|
|
67
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
68
|
-
|
|
69
|
-
cy.contains(labelExitFullscreen).realClick();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('exits fullscreen mode when the button is clicked', () => {
|
|
73
|
-
initialize();
|
|
74
|
-
|
|
75
|
-
cy.get('#test')
|
|
76
|
-
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
77
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
78
|
-
|
|
79
|
-
cy.contains(labelEnterFullscreen).realClick();
|
|
80
|
-
|
|
81
|
-
cy.get('#test')
|
|
82
|
-
.should('have.attr', 'data-fullscreenActivated', 'true')
|
|
83
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
84
|
-
|
|
85
|
-
cy.contains(labelExitFullscreen).realClick();
|
|
86
|
-
|
|
87
|
-
cy.get('#test')
|
|
88
|
-
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
89
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('toggles fullscreen mode when the corresponding shortcut is clicked', () => {
|
|
93
|
-
initialize();
|
|
94
|
-
|
|
95
|
-
cy.get('#test')
|
|
96
|
-
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
97
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
98
|
-
|
|
99
|
-
cy.get('#test').realPress(['F']);
|
|
100
|
-
|
|
101
|
-
cy.get('#test')
|
|
102
|
-
.should('have.attr', 'data-fullscreenActivated', 'true')
|
|
103
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
104
|
-
|
|
105
|
-
cy.get('#test').realPress(['F']);
|
|
106
|
-
|
|
107
|
-
cy.get('#test')
|
|
108
|
-
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
109
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
['input', 'textarea'].forEach((tag) => {
|
|
113
|
-
it(`cannot toggle fullscreen feature using the shortcut when ${tag === 'input' ? 'an' : 'a'} ${tag} is focused`, () => {
|
|
114
|
-
initialize();
|
|
115
|
-
|
|
116
|
-
cy.get('#test')
|
|
117
|
-
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
118
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
119
|
-
|
|
120
|
-
cy.get(`#${tag}`).focus();
|
|
121
|
-
|
|
122
|
-
cy.get('#test').realPress(['F']);
|
|
123
|
-
|
|
124
|
-
cy.get('#test')
|
|
125
|
-
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
126
|
-
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
127
|
-
cy.get(`#${tag}`).should('have.value', 'F');
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { browserLocaleAtom, userAtom } from '@centreon/ui-context';
|
|
2
|
-
|
|
3
|
-
import { createStore, Provider } from 'jotai';
|
|
4
|
-
|
|
5
|
-
import { useLocale } from '.';
|
|
6
|
-
|
|
7
|
-
const TestComponent = () => {
|
|
8
|
-
const locale = useLocale();
|
|
9
|
-
|
|
10
|
-
return <p>{locale}</p>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const initialize = ({ userLocale, browserLocale }) => {
|
|
14
|
-
const store = createStore();
|
|
15
|
-
|
|
16
|
-
store.set(userAtom, { locale: userLocale });
|
|
17
|
-
store.set(browserLocaleAtom, browserLocale);
|
|
18
|
-
|
|
19
|
-
cy.mount({
|
|
20
|
-
Component: (
|
|
21
|
-
<Provider store={store}>
|
|
22
|
-
<TestComponent />
|
|
23
|
-
</Provider>
|
|
24
|
-
)
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
describe('useLocale', () => {
|
|
29
|
-
it('displays the user locale when the corresponding atom is set', () => {
|
|
30
|
-
initialize({ browserLocale: 'en', userLocale: 'fi' });
|
|
31
|
-
|
|
32
|
-
cy.contains('fi').should('be.visible');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('displays the browser locale when the user locale is not set', () => {
|
|
36
|
-
initialize({ browserLocale: 'de', userLocale: null });
|
|
37
|
-
|
|
38
|
-
cy.contains('de').should('be.visible');
|
|
39
|
-
});
|
|
40
|
-
});
|