import { newSpecPage } from "@stencil/core/testing";
import { BpSdkIconContainer } from "./bp-sdk-icon-container";
describe('bp-sdk-icon-container', () => {
    it('renders', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-icon-container></bp-sdk-icon-container>',
            components: [BpSdkIconContainer],
        });
        await page.waitForChanges();
        expect(page.root.querySelector('.bp-sdk-icon__container--fallback')).toBeTruthy();
        expect(page.root.querySelector('bp-sdk-icon')).toBeFalsy();
    });
    it('renders external component if defined', async () => {
        const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
        const page = await newSpecPage({
            html: '<bp-sdk-icon-container></bp-sdk-icon-container>',
            components: [BpSdkIconContainer],
        });
        await page.waitForChanges();
        const element = page.root.querySelector('div');
        expect(element).toBeFalsy();
        whenDefinedMock.mockRestore();
    });
    it('renders bp-sdk-icon if defined', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-icon-container></bp-sdk-icon-container>',
            components: [BpSdkIconContainer],
        });
        page.rootInstance.iconDefined = true;
        await page.waitForChanges();
        expect(page.root.querySelector('.bp-sdk-icon__container--fallback')).toBeFalsy();
        expect(page.root.querySelector('bp-sdk-icon')).toBeTruthy();
    });
});
