import { newSpecPage } from '@stencil/core/testing';
import { BsInput } from '../bs-input';
import { faker } from '@faker-js/faker';
const id = faker.datatype.uuid();
const placeholder = faker.random.words();
describe('bs-input', () => {
  it('passes expected attributes', async () => {
    const page = await newSpecPage({
      components: [BsInput],
      html: `<bs-input
        placeholder="${placeholder}"
        pattern="a"
        readonly="true"
      ></bs-input>`,
    });
    let component = page.root;
    let input = component.querySelector('input');
    await page.waitForChanges();
    expect(input.getAttribute('placeholder')).toBe(placeholder);
    expect(input).not.toHaveAttribute('pattern');
    expect(input).not.toHaveAttribute('readonly');
  });
  it('handles inputId prop', async () => {
    const page = await newSpecPage({
      components: [BsInput],
      html: `<bs-input input-id="${id}"></bs-input>`,
    });
    const component = page.root;
    const input = component.querySelector('input');
    expect(input.getAttribute('id')).toBe(id);
  });
  it('handles error prop', async () => {
    const page = await newSpecPage({
      components: [BsInput],
      html: `<bs-input error="true"></bs-input>`,
    });
    const component = page.root;
    const input = component.querySelector('input');
    expect(input).toHaveAttribute('data-error');
    component.error = false;
    await page.waitForChanges();
    expect(input).not.toHaveAttribute('data-error');
  });
  it('handles disabled prop', async () => {
    const page = await newSpecPage({
      components: [BsInput],
      html: `<bs-input disabled="true"></bs-input>`,
    });
    const component = page.root;
    const input = component.querySelector('input');
    expect(input).toHaveAttribute('disabled');
    component.disabled = false;
    await page.waitForChanges();
    expect(input).not.toHaveAttribute('disabled');
    component.disabled = undefined;
    await page.waitForChanges();
    expect(input).not.toHaveAttribute('disabled');
  });
});
//# sourceMappingURL=bs-input.spec.js.map
