import { faker } from '@faker-js/faker';
import { newSpecPage } from '@stencil/core/testing';
import { BsProfile } from '../bs-profile';
const imgSizes = ['xs', 'sm', 'md', 'lg', 'xl'];
const orientations = ['horizontal', 'vertical'];
describe('bs-profile', () => {
  it('Renders <bs-profile-layout> with a layout prop', async () => {
    const layout = faker.helpers.arrayElement(orientations);
    const page = await newSpecPage({
      components: [BsProfile],
      html: `<bs-profile layout="${layout}"></bs-profile>`,
    });
    const component = page.root.querySelector('bs-profile-layout');
    expect(component.getAttribute('layout')).toBe(layout);
  });
  it('Renders <bs-profile-layout> with an href prop', async () => {
    const profileURL = faker.internet.url();
    const page = await newSpecPage({
      components: [BsProfile],
      html: `<bs-profile href="${profileURL}"></bs-profile>`,
    });
    const component = page.root.querySelector('bs-profile-layout');
    expect(component.getAttribute('href')).toBe(profileURL);
  });
  describe('A <bs-profile-img> inside a <bs-profile>', () => {
    it('Renders <bs-profile-img> with a src prop', async () => {
      const imageSrc = faker.image.imageUrl();
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile image-src="${imageSrc}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-img');
      expect(component.getAttribute('src')).toBe(imageSrc);
    });
    it('Renders <bs-profile-img> with a size prop', async () => {
      const imageSize = faker.helpers.arrayElement(imgSizes);
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile image-size="${imageSize}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-img');
      expect(component.getAttribute('size')).toBe(imageSize);
    });
    it('Renders the <bs-profile-img> with a default size of lg.', async () => {
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-img');
      expect(component.getAttribute('size')).toBe('lg');
    });
    it('Renders <bs-profile-img> with a initials prop', async () => {
      const initials = faker.random.alpha(2);
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile initials="${initials}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-img');
      expect(component.getAttribute('initials')).toBe(initials);
    });
    it('Renders <bs-profile-img> with a profileName prop', async () => {
      const fullName = faker.name.fullName();
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile profile-name="${fullName}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-img');
      expect(component.getAttribute('profile-name')).toBe(fullName);
    });
  });
  describe('A <bs-profile-details> inside a <bs-profile>', () => {
    it('Renders <bs-profile-details> with a profileName prop', async () => {
      const fullName = faker.name.fullName();
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile profile-name="${fullName}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-details');
      expect(component.getAttribute('profile-name')).toBe(fullName);
    });
    it('Renders <bs-profile-details> with a company prop', async () => {
      const companyName = faker.company.name();
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile company="${companyName}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-details');
      expect(component.getAttribute('company')).toBe(companyName);
    });
    it('Renders <bs-profile-details> with a jobTitle prop', async () => {
      const title = faker.name.jobTitle();
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile job-title="${title}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-details');
      expect(component.getAttribute('job-title')).toBe(title);
    });
    it('Renders <bs-profile-details> with a email prop', async () => {
      const email = faker.internet.email();
      const page = await newSpecPage({
        components: [BsProfile],
        html: `<bs-profile email="${email}"></bs-profile>`,
      });
      const component = page.root.querySelector('bs-profile-details');
      expect(component.getAttribute('email')).toBe(email);
    });
  });
});
//# sourceMappingURL=bs-profile.spec.js.map
