import { newSpecPage } from "@stencil/core/testing";
import { BpSdkVehicleQuestionSetButton } from "./bp-sdk-vehicle-question-set-button";
describe('bp-sdk-vehicle-question-set-button', () => {
    it('renders', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-vehicle-question-set-button></bp-sdk-vehicle-question-set-button>',
            components: [BpSdkVehicleQuestionSetButton],
        });
        await page.waitForChanges();
        const element = page.root.querySelector('bp-sdk-button');
        expect(element).toBeTruthy();
        expect(page.root.querySelector('bp-sdk-external-vehicle-question-set-button')).toBeFalsy();
    });
    it('renders extra css classes', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-vehicle-question-set-button></bp-sdk-vehicle-question-set-button>',
            components: [BpSdkVehicleQuestionSetButton],
        });
        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-vehicle-question-set-button></bp-sdk-vehicle-question-set-button>',
            components: [BpSdkVehicleQuestionSetButton],
        });
        await page.waitForChanges();
        expect(page.root.querySelector('bp-sdk-external-vehicle-question-set-button')).toBeTruthy();
        whenDefinedMock.mockRestore();
    });
});
