import { newSpecPage } from '@stencil/core/testing';
import { BsInputAddon } from '../bs-input-addon';
import { faker } from '@faker-js/faker';
import { queryByPlaceholderText, queryByText } from '@testing-library/dom';
const placeholder = faker.random.words();
const text = faker.random.words();
describe('bs-input-addon', () => {
  let page;
  let component;
  beforeEach(async () => {
    page = await newSpecPage({
      components: [BsInputAddon],
      html: `<bs-input-addon>
        <div>${text}</div>
        <input placeholder="${placeholder}">
      </bs-input-addon>`,
    });
    component = page.root;
  });
  it('renders children', async () => {
    expect(queryByPlaceholderText(component, placeholder)).toBeTruthy();
    expect(queryByText(component, text)).toBeTruthy();
    expect(queryByText(component, text).nextElementSibling.tagName).toBe('INPUT');
  });
  it('handles multifocus prop', async () => {
    component.multifocus = true;
    await page.waitForChanges();
    expect(component).toHaveAttribute('data-multifocus');
    component.multifocus = false;
    await page.waitForChanges();
    expect(component).not.toHaveAttribute('data-multifocus');
  });
  it('handles variant prop', async () => {
    const variant = 'inner-bordered';
    component.variant = variant;
    await page.waitForChanges();
    expect(component.getAttribute('data-variant')).toBe(variant);
    component.variant = undefined;
    await page.waitForChanges();
    expect(component).not.toHaveAttribute('data-variant');
  });
});
//# sourceMappingURL=bs-input-addon.spec.js.map
