import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import ModuleCreateForm from '.';

describe('ModuleCreateForm', () => {
  it('送信ボタンが既存の acms-admin-btn 系クラスを保ったまま描画される', () => {
    render(<ModuleCreateForm blogId={1} />);

    const submitButton = screen.getByRole('button', { name: 'module_index.module_create_form.submit' });
    expect(submitButton).toHaveAttribute('type', 'submit');
    expect(submitButton).toHaveClass('acms-admin-btn', 'acms-admin-btn-success');
  });

  it('hidden フィールドに blogId が反映される', () => {
    const { container } = render(<ModuleCreateForm blogId={42} />);

    expect(container.querySelector('input[name="bid"]')).toHaveValue('42');
  });
});
