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

describe('resizable', () => {
  beforeEach(resetDOM);

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

  it('disconnect clears resizing state attributes', () => {
    const host = mountHost();
    const inst = connectTrait(resizable, host);
    expect(() => inst.disconnect(host)).not.toThrow();
    expect(host.hasAttribute('data-resizable-resizing')).toBe(false);
    expect(host.hasAttribute('data-resizable-edge')).toBe(false);
  });
});
