import { describe, it, expect, beforeEach } from 'vitest';
import { fadePresence } from './fade-presence.js';
import { mountHost, connectTrait, resetDOM } from '../test-helpers.js';

describe('fade-presence', () => {
  beforeEach(resetDOM);

  it('connect attaches without throwing', () => {
    const host = mountHost();
    expect(() => connectTrait(fadePresence, host)).not.toThrow();
  });

  it('disconnect clears managed attributes', () => {
    const host = mountHost();
    const inst = connectTrait(fadePresence, host);
    inst.disconnect(host);
    expect(host.hasAttribute('data-fade-presence-entering')).toBe(false);
    expect(host.hasAttribute('data-fade-presence-exiting')).toBe(false);
  });
});
