import { describe, test, expect } from 'vitest';
import { CTASection } from './CTASection';

const toHtml = (CTASection as any).toHtml;

describe('CTASection.toHtml basic export', () => {
  test('renders heading, description, and CTA buttons', () => {
    const { html } = toHtml({ heading: 'Hi', description: 'Sub', ctas: [{ text: 'Go', href: '#', variant: 'primary' }] }, '');
    expect(html).toContain('Hi');
    expect(html).toContain('Sub');
    expect(html).toContain('Go');
  });

  test('box-model style props (margin/padding/border/boxShadow/opacity) flow through to the section style=""', () => {
    const { html } = toHtml({
      heading: 'Hi',
      description: 'Sub',
      style: { marginTop: '10px', paddingLeft: '5px', border: '1px solid #000', boxShadow: '0 1px 2px rgba(0,0,0,0.1)', opacity: '0.5' },
    }, '');
    expect(html).toContain('margin-top:10px');
    expect(html).toContain('padding-left:5px');
    expect(html).toContain('border:1px solid #000');
    expect(html).toContain('box-shadow:0 1px 2px rgba(0,0,0,0.1)');
    expect(html).toContain('opacity:0.5');
  });
});

describe('CTASection.craft.props includes the box-model/animation/visibility rollout props', () => {
  test('animation, animationDelay, and all 3 hideOn* flags are declared (blank/false defaults)', () => {
    const props = (CTASection as any).craft.props;
    expect(props).toHaveProperty('animation', '');
    expect(props).toHaveProperty('animationDelay', '');
    expect(props).toHaveProperty('hideOnDesktop', false);
    expect(props).toHaveProperty('hideOnTablet', false);
    expect(props).toHaveProperty('hideOnMobile', false);
  });
});
