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

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

describe('UiSidebarHeader', () => {
  test('renders title slot and sidebar trigger', () => {
    const { getByRole, getByText } = render(
      createSidebarShell(
        '<UiSidebarHeader tooltip="Tip">Acme</UiSidebarHeader>',
        {
          UiSidebarHeader,
        },
      ),
    );
    expect(getByText('Acme')).toBeInTheDocument();
    expect(getByRole('button', { name: 'Toggle Sidebar' })).toBeInTheDocument();
  });
});
