import { newSpecPage } from "@stencil/core/testing";
import { BpSdkDriverQuestionSetButton } from "./bp-sdk-driver-question-set-button";
describe('bp-sdk-driver-question-set-button', () => {
    it('renders', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-driver-question-set-button></bp-sdk-driver-question-set-button>',
            components: [BpSdkDriverQuestionSetButton],
        });
        await page.waitForChanges();
        const element = page.root.querySelector('bp-sdk-button');
        expect(element).toBeTruthy();
        expect(page.root.querySelector('bp-sdk-external-driver-question-set-button')).toBeFalsy();
    });
    it('renders extra css classes', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-driver-question-set-button></bp-sdk-driver-question-set-button>',
            components: [BpSdkDriverQuestionSetButton],
        });
        const instance = page.rootInstance;
        instance.extraCssClasses = 'test-extra-class';
        await page.waitForChanges();
        const element = page.root.querySelector('bp-sdk-button');
        expect(element.className).toEqual(expect.stringContaining(instance.extraCssClasses));
    });
    it('renders external component if defined', async () => {
        const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
        const page = await newSpecPage({
            html: '<bp-sdk-driver-question-set-button></bp-sdk-driver-question-set-button>',
            components: [BpSdkDriverQuestionSetButton],
        });
        await page.waitForChanges();
        expect(page.root.querySelector('bp-sdk-external-driver-question-set-button')).toBeTruthy();
        whenDefinedMock.mockRestore();
    });
});
