import { newSpecPage } from "@stencil/core/testing";
import { BpSdkDialogCloseButton } from "./bp-sdk-dialog-close-button";
describe('bp-sdk-dialog-close-button', () => {
    it('renders', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-dialog-close-button></bp-sdk-dialog-close-button>',
            components: [BpSdkDialogCloseButton],
        });
        await page.waitForChanges();
        expect(page.root.querySelector('bp-sdk-button')).toBeTruthy();
        expect(page.root.querySelector('bp-sdk-external-dialog-close-button')).toBeFalsy();
    });
    it('renders external component if defined', async () => {
        const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
        const page = await newSpecPage({
            html: '<bp-sdk-dialog-close-button></bp-sdk-dialog-close-button>',
            components: [BpSdkDialogCloseButton],
        });
        await page.waitForChanges();
        expect(page.root.querySelector('bp-sdk-button')).toBeFalsy();
        expect(page.root.querySelector('bp-sdk-external-dialog-close-button')).toBeTruthy();
        whenDefinedMock.mockRestore();
    });
});
