import {
  createDirectiveFactory,
  SpectatorDirective,
} from '@ngneat/spectator/jest';
import { ListboxDirective } from './listbox.directive';
import { CdkListbox } from '@angular/cdk/listbox';

describe('ListboxDirective', () => {
  let spectator: SpectatorDirective<ListboxDirective>;

  const createDirective = createDirectiveFactory({
    directive: ListboxDirective,
  });

  beforeEach(() => {
    spectator = createDirective('<div uiListbox></div>');
  });

  it('should create an instance', () => {
    expect(spectator.directive).toBeTruthy();
  });

  it('should have the ui-listbox class', () => {
    expect(spectator.element).toHaveClass('ui-listbox');
  });

  it('should have CdkListbox applied', () => {
    const cdkListboxInstance = spectator.query(CdkListbox);

    expect(cdkListboxInstance).toBeTruthy();
  });
});
