Test public layout header

bosnian
Alex Gleason 2023-01-15 13:07:42 -06:00
rodzic 300d3a0200
commit a81577bcf6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 33 dodań i 1 usunięć

Wyświetl plik

@ -0,0 +1,32 @@
import React from 'react';
import { storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
import { render, screen } from 'soapbox/jest/test-helpers';
import Header from '../header';
describe('<Header />', () => {
it('successfully renders', () => {
render(<Header />);
expect(screen.getByTestId('public-layout-header')).toBeInTheDocument();
});
it('doesn\'t display the signup button by default', () => {
render(<Header />);
expect(screen.queryByText('Register')).not.toBeInTheDocument();
});
describe('with registrations enabled', () => {
it('displays the signup button', () => {
render(<Header />, undefined, storeOpen);
expect(screen.getByText('Register')).toBeInTheDocument();
});
});
describe('with registrations closed, Pepe enabled', () => {
it('displays the signup button', () => {
render(<Header />, undefined, storePepeOpen);
expect(screen.getByText('Register')).toBeInTheDocument();
});
});
});

Wyświetl plik

@ -65,7 +65,7 @@ const Header = () => {
if (mfaToken) return <Redirect to={`/login?token=${encodeURIComponent(mfaToken)}`} />;
return (
<header>
<header data-testid='public-layout-header'>
<nav className='max-w-7xl mx-auto px-4 sm:px-6 lg:px-8' aria-label='Header'>
<div className='w-full py-6 flex items-center justify-between border-b border-indigo-500 lg:border-none'>
<div className='flex items-center sm:justify-center relative w-36'>