import { describe, it, expect, beforeEach } from 'vitest';
import { attentionPulse } from './attention-pulse.js';
import { mountHost, connectTrait, resetDOM } from '../test-helpers.js';

describe('attention-pulse', () => {
  beforeEach(resetDOM);

  it('connect sets data-attention-pulse-active', () => {
    const host = mountHost();
    connectTrait(attentionPulse, host);
    expect(host.hasAttribute('data-attention-pulse-active')).toBe(true);
  });

  it('disconnect clears active + animation', () => {
    const host = mountHost();
    const inst = connectTrait(attentionPulse, host);
    inst.disconnect(host);
    expect(host.hasAttribute('data-attention-pulse-active')).toBe(false);
    expect(host.style.animation).toBe('');
  });

  it('respects data-pulse-interval (default 2000ms)', () => {
    const host = mountHost('div', { 'data-pulse-interval': '500' });
    expect(() => connectTrait(attentionPulse, host)).not.toThrow();
  });
});
