From 5d3e8a4d0c2ce2ad8f22df857ab3ce54fcfc38ac Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 3 Nov 2023 12:22:47 +0100
Subject: refactor(components): replace Toolbar with Navbar component

* remove SearchModal and SettingsModal components
* add a generic NavbarItem component (instead of the previous toolbar
items to avoid unreadable styles...)
* move FlippingLabel component logic into NavbarItem since it is only
used here
---
 src/components/organisms/navbar/navbar.test.tsx | 42 +++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 src/components/organisms/navbar/navbar.test.tsx

(limited to 'src/components/organisms/navbar/navbar.test.tsx')

diff --git a/src/components/organisms/navbar/navbar.test.tsx b/src/components/organisms/navbar/navbar.test.tsx
new file mode 100644
index 0000000..35b33f2
--- /dev/null
+++ b/src/components/organisms/navbar/navbar.test.tsx
@@ -0,0 +1,42 @@
+import { describe, expect, it } from '@jest/globals';
+import { render, screen as rtlScreen } from '@testing-library/react';
+import { Navbar, type NavbarItems } from './navbar';
+
+const doNothing = () => {
+  // do nothing;
+};
+
+const items: NavbarItems = [
+  {
+    icon: 'hamburger',
+    id: 'main-nav',
+    isActive: false,
+    label: 'Nav',
+    contents: 'Main nav contents',
+    onToggle: doNothing,
+  },
+  {
+    icon: 'magnifying-glass',
+    id: 'search',
+    isActive: false,
+    label: 'Search',
+    contents: 'Search contents',
+    onToggle: doNothing,
+  },
+  {
+    icon: 'cog',
+    id: 'settings',
+    isActive: false,
+    label: 'Settings',
+    contents: 'Settings contents',
+    onToggle: doNothing,
+  },
+];
+
+describe('Navbar', () => {
+  it('renders the given items', () => {
+    render(<Navbar items={items} />);
+
+    expect(rtlScreen.getAllByRole('listitem')).toHaveLength(items.length);
+  });
+});
-- 
cgit v1.2.3

