import React from 'react'; import { render, waitFor, screen } from '@testing-library/react'; import { IntlProvider } from 'react-intl'; import { QueryClient, QueryClientProvider } from 'react-query'; import { ThemeProvider, lightTheme } from '@strapi/parts'; import { useRBAC } from '@strapi/helper-plugin'; import ProtectedAdvancedSettingsPage from '../index'; import server from './utils/server'; jest.mock('@strapi/helper-plugin', () => ({ ...jest.requireActual('@strapi/helper-plugin'), useNotification: jest.fn(), useFocusWhenNavigate: jest.fn(), useOverlayBlocker: jest.fn(() => ({ lockApp: jest.fn, unlockApp: jest.fn() })), useRBAC: jest.fn(), CheckPagePermissions: ({ children }) => children, })); const client = new QueryClient({ defaultOptions: { queries: { retry: false, }, }, }); const App = ( ); describe('ADMIN | Pages | Settings | Advanced Settings', () => { beforeAll(() => server.listen()); beforeEach(() => { jest.clearAllMocks(); }); afterEach(() => { server.resetHandlers(); }); afterAll(() => { jest.resetAllMocks(); server.close(); }); it('renders and matches the snapshot', async () => { useRBAC.mockImplementation(() => ({ isLoading: false, allowedActions: { canUpdate: true }, })); const { container } = render(App); await waitFor(() => { expect(screen.getByText('Default role for authenticated users')).toBeInTheDocument(); }); expect(container.firstChild).toMatchInlineSnapshot(` .c14 { background: #ffffff; padding-top: 24px; padding-right: 32px; padding-bottom: 24px; padding-left: 32px; border-radius: 4px; box-shadow: 0px 1px 4px rgba(33,33,52,0.1); } .c10 { font-weight: 500; font-size: 0.75rem; line-height: 1.33; color: #32324d; } .c8 { padding-right: 8px; } .c5 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; cursor: pointer; padding: 8px; border-radius: 4px; background: #ffffff; border: 1px solid #dcdce4; } .c5 svg { height: 12px; width: 12px; } .c5 svg > g, .c5 svg path { fill: #ffffff; } .c5[aria-disabled='true'] { pointer-events: none; } .c6 { padding: 8px 16px; background: #4945ff; border: none; border: 1px solid #4945ff; background: #4945ff; } .c6 .c7 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c6 .c9 { color: #ffffff; } .c6[aria-disabled='true'] { border: 1px solid #dcdce4; background: #eaeaef; } .c6[aria-disabled='true'] .c9 { color: #666687; } .c6[aria-disabled='true'] svg > g, .c6[aria-disabled='true'] svg path { fill: #666687; } .c6[aria-disabled='true']:active { border: 1px solid #dcdce4; background: #eaeaef; } .c6[aria-disabled='true']:active .c9 { color: #666687; } .c6[aria-disabled='true']:active svg > g, .c6[aria-disabled='true']:active svg path { fill: #666687; } .c6:hover { border: 1px solid #7b79ff; background: #7b79ff; } .c6:active { border: 1px solid #4945ff; background: #4945ff; } .c22 { position: absolute; left: 0; right: 0; bottom: 0; top: 0; width: 100%; background: transparent; border: none; } .c22:focus { outline: none; } .c20 { font-weight: 500; font-size: 0.75rem; line-height: 1.33; color: #32324d; } .c27 { font-weight: 400; font-size: 0.875rem; line-height: 1.43; color: #32324d; } .c31 { font-weight: 400; font-size: 0.75rem; line-height: 1.33; color: #666687; } .c26 { padding-right: 16px; padding-left: 16px; } .c28 { padding-left: 12px; } .c23 { 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; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c25 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c19 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .c19 > * { margin-top: 0; margin-bottom: 0; } .c19 > * + * { margin-top: 4px; } .c21 { position: relative; border: 1px solid #dcdce4; padding-right: 12px; border-radius: 4px; background: #ffffff; overflow: hidden; } .c21:focus-within { border: 1px solid #4945ff; } .c29 { background: transparent; border: none; position: relative; z-index: 1; } .c29 svg { height: 0.6875rem; width: 0.6875rem; } .c29 svg path { fill: #666687; } .c30 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; background: none; border: none; } .c30 svg { width: 0.375rem; } .c24 { min-height: 2.5rem; } .c15 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .c15 > * { margin-top: 0; margin-bottom: 0; } .c15 > * + * { margin-top: 16px; } .c16 { font-weight: 500; font-size: 1rem; line-height: 1.25; color: #32324d; } .c52 { font-weight: 500; font-size: 0.75rem; line-height: 1.33; color: #32324d; } .c51 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c53 { 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; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c55 { border: none; border-radius: 4px; padding-left: 16px; padding-right: 16px; color: #32324d; font-weight: 400; font-size: 0.875rem; display: block; width: 100%; height: 2.5rem; } .c55::-webkit-input-placeholder { color: #8e8ea9; opacity: 1; } .c55::-moz-placeholder { color: #8e8ea9; opacity: 1; } .c55:-ms-input-placeholder { color: #8e8ea9; opacity: 1; } .c55::placeholder { color: #8e8ea9; opacity: 1; } .c55[aria-disabled='true'] { background: inherit; color: inherit; } .c54 { border: 1px solid #dcdce4; border-radius: 4px; background: #ffffff; } .c56 { border: 1px solid #dcdce4; border-radius: 4px; background: #ffffff; color: #666687; background: #eaeaef; } .c50 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .c50 > * { margin-top: 0; margin-bottom: 0; } .c50 > * + * { margin-top: 4px; } .c49 textarea { height: 5rem; } .c36 { font-weight: 500; font-size: 0.75rem; line-height: 1.33; color: #32324d; } .c44 { font-weight: 500; font-size: 0.75rem; line-height: 1.33; color: #b72b1a; } .c47 { font-weight: 400; font-size: 0.75rem; line-height: 1.33; color: #666687; } .c40 { background: #ffffff; border-radius: 4px; } .c42 { background: #fcecea; padding-top: 12px; padding-right: 32px; padding-bottom: 12px; padding-left: 32px; } .c45 { padding-top: 12px; padding-right: 32px; padding-bottom: 12px; padding-left: 32px; } .c35 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c34 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .c34 > * { margin-top: 0; margin-bottom: 0; } .c34 > * + * { margin-top: 4px; } .c38 { border: 0; -webkit-clip: rect(0 0 0 0); clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .c37 { position: relative; display: inline-block; } .c37:active, .c37:focus-within { outline: 2px solid #4945ff; outline-offset: 2px; } .c41 { position: relative; z-index: 1; border: 1px solid #dcdce4; display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; overflow: hidden; } .c46 { text-transform: uppercase; } .c43 { text-transform: uppercase; border-right: 1px solid #dcdce4; } .c39 { position: absolute; left: 4px; top: 4px; } .c33 { width: -webkit-fit-content; width: -moz-fit-content; width: fit-content; } .c0 { outline: none; } .c1 { background: #f6f6f9; padding-top: 56px; padding-right: 56px; padding-bottom: 56px; padding-left: 56px; } .c13 { padding-right: 56px; padding-left: 56px; } .c2 { 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; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c3 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; } .c4 { font-weight: 600; font-size: 2rem; line-height: 1.25; color: #32324d; } .c11 { font-weight: 400; font-size: 0.875rem; line-height: 1.43; color: #666687; } .c12 { font-size: 1rem; line-height: 1.5; } .c17 { display: grid; grid-template-columns: repeat(12,1fr); gap: 24px; } .c18 { grid-column: span 6; word-break: break-all; } .c32 { grid-column: span 12; word-break: break-all; } .c48 { grid-column: span 6; word-break: break-all; } @media (max-width:68.75rem) { .c18 { grid-column: span 12; } } @media (max-width:34.375rem) { .c18 { grid-column: span; } } @media (max-width:68.75rem) { .c32 { grid-column: span; } } @media (max-width:34.375rem) { .c32 { grid-column: span 12; } } @media (max-width:68.75rem) { .c48 { grid-column: span; } } @media (max-width:34.375rem) { .c48 { grid-column: span 12; } }

Advanced Settings

Settings

Default role for authenticated users

It will attach the new authenticated user to the selected role.

Disallow the user to create multiple accounts using the same email address with different authentication providers.

When disabled (OFF), the registration process is forbidden. No one can subscribe anymore no matter the used provider.

When enabled (ON), new registered users receive a confirmation email.

`); }); });