mirror of
https://github.com/strapi/strapi.git
synced 2025-09-20 14:00:48 +00:00
added test case
This commit is contained in:
parent
b00348c30d
commit
ea39f719f7
@ -4,7 +4,7 @@ import { HeaderLayout } from '@strapi/design-system/Layout';
|
|||||||
import { Main } from '@strapi/design-system/Main';
|
import { Main } from '@strapi/design-system/Main';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
|
|
||||||
const ListPage = () => {
|
const ListView = () => {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
const title = formatMessage({
|
const title = formatMessage({
|
||||||
@ -26,4 +26,4 @@ const ListPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ListPage;
|
export default ListView;
|
@ -0,0 +1,121 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { render } from '@testing-library/react';
|
||||||
|
import { IntlProvider } from 'react-intl';
|
||||||
|
import { ThemeProvider, lightTheme } from '@strapi/design-system';
|
||||||
|
import { Router } from 'react-router-dom';
|
||||||
|
import { createMemoryHistory } from 'history';
|
||||||
|
import ListView from '../index';
|
||||||
|
|
||||||
|
const history = createMemoryHistory();
|
||||||
|
|
||||||
|
const App = (
|
||||||
|
<ThemeProvider theme={lightTheme}>
|
||||||
|
<IntlProvider locale="en" messages={{}} defaultLocale="en" textComponent="span">
|
||||||
|
<Router history={history}>
|
||||||
|
<ListView />
|
||||||
|
</Router>
|
||||||
|
</IntlProvider>
|
||||||
|
</ThemeProvider>
|
||||||
|
);
|
||||||
|
|
||||||
|
describe('ADMIN | Pages | AUDIT LOGS | ListView', () => {
|
||||||
|
it('renders and matches the snapshot', () => {
|
||||||
|
const {
|
||||||
|
container: { firstChild },
|
||||||
|
} = render(App);
|
||||||
|
|
||||||
|
expect(firstChild).toMatchInlineSnapshot(`
|
||||||
|
.c1 {
|
||||||
|
background: #f6f6f9;
|
||||||
|
padding-top: 40px;
|
||||||
|
padding-right: 56px;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
padding-left: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.c2 {
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-flex-direction: row;
|
||||||
|
-ms-flex-direction: row;
|
||||||
|
flex-direction: row;
|
||||||
|
-webkit-box-pack: justify;
|
||||||
|
-webkit-justify-content: space-between;
|
||||||
|
-ms-flex-pack: justify;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.c3 {
|
||||||
|
-webkit-align-items: center;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-webkit-flex-direction: row;
|
||||||
|
-ms-flex-direction: row;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.c4 {
|
||||||
|
color: #32324d;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 2rem;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.c5 {
|
||||||
|
color: #666687;
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.c0:focus-visible {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
<main
|
||||||
|
aria-labelledby="main-content-title"
|
||||||
|
class="c0"
|
||||||
|
id="main-content"
|
||||||
|
tabindex="-1"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style="height: 0px;"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="c1"
|
||||||
|
data-strapi-header="true"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="c2"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="c3"
|
||||||
|
>
|
||||||
|
<h1
|
||||||
|
class="c4"
|
||||||
|
>
|
||||||
|
Audit Logs
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p
|
||||||
|
class="c5"
|
||||||
|
>
|
||||||
|
Logs of all the activities than happened on your environment
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
});
|
@ -1,11 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
||||||
import adminPermissions from '../../../../../permissions';
|
import adminPermissions from '../../../../../permissions';
|
||||||
import ListPage from '../ListPage';
|
import ListView from '../ListView';
|
||||||
|
|
||||||
const ProtectedListPage = () => (
|
const ProtectedListPage = () => (
|
||||||
<CheckPagePermissions permissions={adminPermissions.settings.auditLogs.main}>
|
<CheckPagePermissions permissions={adminPermissions.settings.auditLogs.main}>
|
||||||
<ListPage />
|
<ListView />
|
||||||
</CheckPagePermissions>
|
</CheckPagePermissions>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user