mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
test: add unit tests for collapse icon
This commit is contained in:
parent
abeb399688
commit
941717c7d4
3 changed files with 27 additions and 3 deletions
24
app/src/__tests__/components/layout/Layout.spec.tsx
Normal file
24
app/src/__tests__/components/layout/Layout.spec.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import React from 'react';
|
||||
import { fireEvent } from '@testing-library/react';
|
||||
import { renderWithProviders } from 'util/tests';
|
||||
import Layout from 'components/layout/Layout';
|
||||
|
||||
describe('Layout component', () => {
|
||||
const render = () => {
|
||||
return renderWithProviders(<Layout />);
|
||||
};
|
||||
|
||||
it('should display the hamburger menu', () => {
|
||||
const { getByTitle } = render();
|
||||
expect(getByTitle('menu')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should toggle collapsed state', () => {
|
||||
const { getByTitle, store } = render();
|
||||
expect(store.sidebarCollapsed).toBe(false);
|
||||
fireEvent.click(getByTitle('menu'));
|
||||
expect(store.sidebarCollapsed).toBe(true);
|
||||
fireEvent.click(getByTitle('menu'));
|
||||
expect(store.sidebarCollapsed).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
@ -43,11 +43,11 @@ const NodeStatus: React.FC = () => {
|
|||
<Wrapper>
|
||||
<StatusTitle>Node Status</StatusTitle>
|
||||
<XLargeText block>
|
||||
<BoltIcon />
|
||||
<BoltIcon title="bolt" />
|
||||
{channelBalance.toLocaleString()} SAT
|
||||
</XLargeText>
|
||||
<SmallText block>
|
||||
<BitcoinIcon />
|
||||
<BitcoinIcon title="bitcoin" />
|
||||
{walletBalance.toLocaleString()}
|
||||
</SmallText>
|
||||
<Divider />
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ const Layout: React.FC = ({ children }) => {
|
|||
return (
|
||||
<Background>
|
||||
<Container>
|
||||
<MenuIcon onClick={app.toggleSidebar} />
|
||||
<MenuIcon title="menu" onClick={app.toggleSidebar} />
|
||||
<Aside collapsed={sidebarCollapsed}>
|
||||
<Sidebar />
|
||||
</Aside>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue