Skip to content

Commit

Permalink
MM-112-menuoptions: added unit test for hamburger button open/close
Browse files Browse the repository at this point in the history
  • Loading branch information
Purbai committed Jul 31, 2024
1 parent a6da30a commit 630dfc7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
19 changes: 1 addition & 18 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,7 @@ test('renders header', () => {
expect(header[0]).toBeInTheDocument();
});

// test('calls onClick when Hamburger button is clicked', () => {
// const handleClick = jest.fn();
// render(<Hamburger label="Click Me" />);
// const button = screen.getByText('Click Me');
// fireEvent.click(button);
// expect(handleClick).towHaveBeenCalledTimes(1);;
// });

// test('test for hamburger menu options ', () => {
// const handleClick = jest.fn();
// render(<Hamburger label="Click Me" />);
// const button = screen.getByText('Click Me');
// fireEvent.click(button);
// const menuitem = screen.getByText('Your Acheivements');
// expect(menuitem).toBeInTheDocument();
// });

test('should toggle menu on button click', () => {
test('should toggle hamburger menu on button click', () => {
render(<Hamburger />);

const button = screen.getByTestId('toggle-button');
Expand Down
2 changes: 1 addition & 1 deletion src/Header/Hamburgerbutton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Hamburger: React.FC<HamburgerProps> = () => {
</button>
{/* display the menu list of clicked/unclicked */}
{isOpen && (
<div className="menu">
<div className="menu" data-testid="menu">
<Menu items={menuItems} />
</div>
)}
Expand Down

0 comments on commit 630dfc7

Please sign in to comment.