Skip to content

Commit

Permalink
test not active cookiemod
Browse files Browse the repository at this point in the history
  • Loading branch information
BelousSofiya committed Oct 31, 2023
1 parent 0ccda30 commit 18b67d5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions FrontEnd/src/components/cookieacception/CookieMod.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { Link } from 'react-router-dom';
import { useCookies } from 'react-cookie';
import styles from './CookieMod.module.css';
Expand Down Expand Up @@ -26,7 +25,7 @@ const CookieMod = ({ active, setActive }) => {
className={`${styles['modal-window']} ${active && styles['active']}`}
onClick={() => setActive(false)}
>
<div className={styles['modal-content']}>
<div className={styles['modal-content']} data-testid="cookiemodal">
<p className={styles['cookie-text']}>
Наш веб-сайт використовує файли cookie, щоб покращити ваш досвід. Ви
можете відмовитися, якщо хочете. Дізнатися більше{' '}
Expand Down
6 changes: 3 additions & 3 deletions FrontEnd/src/components/cookieacception/CookieMod.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
display: flex;
align-items: center;
justify-content: center;
transform: scale(0);
visibility: hidden;
}

.modal-window.active {
transform: scale(1);
visibility: visible;
}

.modal-content {
Expand Down Expand Up @@ -57,4 +57,4 @@
.cookie-text {
text-align: justify;
color: #187860;
}
}
9 changes: 9 additions & 0 deletions FrontEnd/src/tests/CookieModal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ describe('CookieMod component unit tests', () => {
expect(linkElement).toBeInTheDocument();
expect(linkElement).toHaveAttribute('href', '/cookies-policy');
});

test('renders hidden cookie modal window', () => {
render(
<MemoryRouter>
<CookieMod active={false} />
</MemoryRouter>
);
const cookieElement = screen.queryByTestId('cookiemodal', { hidden: true });
});
});

0 comments on commit 18b67d5

Please sign in to comment.