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

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

describe('UiSidebarTrigger', () => {
  test('forwards aria-label', () => {
    const { getByRole } = render(
      createSidebarShell('<UiSidebarTrigger />', { UiSidebarTrigger }),
    );
    expect(getByRole('button', { name: 'Toggle Sidebar' })).toHaveAttribute(
      'data-sidebar',
      'trigger',
    );
  });
});
