import { newSpecPage } from "@stencil/core/testing";
import { BpSdkVehicleYears } from "./bp-sdk-vehicle-years";
describe('bp-sdk-vehicle-years', () => {
    it('renders', async () => {
        const page = await newSpecPage({
            html: '<bp-sdk-vehicle-years></bp-sdk-vehicle-years>',
            components: [BpSdkVehicleYears],
        });
        await page.waitForChanges();
        const element = page.root.querySelector('bp-sdk-dynamic-input');
        expect(element).toBeTruthy();
    });
    it('renders external component if defined', async () => {
        const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
        const page = await newSpecPage({
            html: '<bp-sdk-vehicle-years></bp-sdk-vehicle-years>',
            components: [BpSdkVehicleYears],
        });
        await page.waitForChanges();
        const element = page.root.querySelector('bp-sdk-vehicle-years');
        expect(element).toBeFalsy();
        whenDefinedMock.mockRestore();
    });
    describe('onIsVehicleTrailerChange', () => {
        it('case: true', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-vehicle-years></bp-sdk-vehicle-years>',
                components: [BpSdkVehicleYears],
            });
            const instance = page.rootInstance;
            instance.fieldType = '';
            instance.inputComponentType = '';
            instance.onIsVehicleTrailerChange(true);
            expect(instance.fieldType).toEqual('vehicle');
            expect(instance.fieldType).toEqual('vehicle');
        });
        it('case: false', async () => {
            const page = await newSpecPage({
                html: '<bp-sdk-vehicle-years></bp-sdk-vehicle-years>',
                components: [BpSdkVehicleYears],
            });
            const instance = page.rootInstance;
            instance.fieldType = '';
            instance.inputComponentType = '';
            instance.onIsVehicleTrailerChange(false);
            expect(instance.fieldType).toEqual('dropdown');
            expect(instance.fieldType).toEqual('dropdown');
        });
    });
});
