import { render } from '@testing-library/vue';
import { describe, expect, test, beforeEach, afterEach, vi } from 'vitest';
import UiSidebarMenu from '../UiSidebarMenu.vue';
import UiSidebarMenuItem from '../UiSidebarMenuItem.vue';
import {
  createSidebarShell,
  mockMatchMediaDesktop,
} from './sidebar-test-helpers';

beforeEach(() => mockMatchMediaDesktop());
afterEach(() => vi.restoreAllMocks());

describe('UiSidebarMenuItem', () => {
  test('wraps row in list item', () => {
    const { container } = render(
      createSidebarShell(
        `
        <UiSidebarMenu>
          <UiSidebarMenuItem><span>Row</span></UiSidebarMenuItem>
        </UiSidebarMenu>
      `,
        { UiSidebarMenu, UiSidebarMenuItem },
      ),
    );
    expect(container.querySelector('[data-sidebar="menu-item"]')).toBeTruthy();
    expect(container).toHaveTextContent('Row');
  });
});
