import { faker } from '@faker-js/faker';
import { newSpecPage } from '@stencil/core/testing';
import { BsProfileLayout } from '../bs-profile-layout';
const orientations = ['horizontal', 'vertical'];
const slotText = faker.random.words();
describe('bs-profile-layout', () => {
  it('renders content in the slot', async () => {
    const page = await newSpecPage({
      components: [BsProfileLayout],
      html: `<bs-profile-layout><p>${slotText}</p></bs-profile-layout>`,
    });
    const component = page.root.querySelector('p');
    expect(component).toEqualText(slotText);
  });
  it('outputs a div if no href is present', async () => {
    const page = await newSpecPage({
      components: [BsProfileLayout],
      html: `<bs-profile-layout></bs-profile-layout>`,
    });
    expect(page.root.querySelector('div')).toBeTruthy();
    expect(page.root.querySelector('a')).toBeFalsy();
  });
  it('outputs an <a> element if the href is present', async () => {
    const page = await newSpecPage({
      components: [BsProfileLayout],
      html: `<bs-profile-layout href="https://example.com"><p>A child element</p></bs-profile-layout>`,
    });
    expect(page.root.querySelector('div')).toBeFalsy();
    expect(page.root.querySelector('a')).toBeTruthy();
  });
  it('changes the orientation of the child content', async () => {
    const layout = faker.helpers.arrayElement(orientations);
    const page = await newSpecPage({
      components: [BsProfileLayout],
      html: `<bs-profile-layout href="https://example.com" layout="${layout}"><p>A child element</p></bs-profile-layout>`,
    });
    const component = page.root.querySelector('a');
    expect(component.getAttribute('data-layout')).toBe(layout);
  });
});
//# sourceMappingURL=bs-profile-layout.spec.js.map
