import { newSpecPage } from "@stencil/core/testing";
import { BpSdkChip } from "./bp-sdk-chip";
describe('bp-sdk-chip', () => {
    it('renders', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-chip type="test"></bp-sdk-chip>',
            components: [BpSdkChip],
        });
        const el = page.root.querySelector('span');
        expect(el.className).toContain('bp-sdk-chip');
    });
    it('renders external component if defined', async () => {
        const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
        const page = await newSpecPage({
            html: '<bp-sdk-chip type="test"></bp-sdk-chip>',
            components: [BpSdkChip],
        });
        await page.waitForChanges();
        const element = page.root.querySelector('span');
        expect(element).toBeFalsy();
        whenDefinedMock.mockRestore();
    });
    it('renders changes to the name data', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-chip type="test"></bp-sdk-chip>',
            components: [BpSdkChip],
        });
        page.rootInstance.text = 'James';
        await page.waitForChanges();
        const element = page.root.querySelector('.bp-sdk-chip');
        expect(element.textContent).toEqual(`James`);
    });
});
