/*!
 * KoliBri - The accessible HTML-Standard
 */
import { h } from "@stencil/core";
import { renderFunctionalComponentToSpecPage } from "../../../../utils/testing";
import NativeOptionFc from "../NativeOption";
describe('NativeOptionFc', () => {
    it('should render and match snapshot', async () => {
        const page = await renderFunctionalComponentToSpecPage(() => h(NativeOptionFc, { value: "testValue", label: "testLabel" }));
        expect(page.root).toMatchSnapshot();
    });
    it('should render an option tag with the correct index and label', async () => {
        const page = await renderFunctionalComponentToSpecPage(() => h(NativeOptionFc, { value: "testValue", index: 1, label: "testLabel" }));
        expect(page.root).toMatchSnapshot();
        const option = page.root;
        expect(option === null || option === void 0 ? void 0 : option.tagName).toBe('OPTION');
        expect(option === null || option === void 0 ? void 0 : option.textContent).toBe('testLabel');
    });
    it('should set selected attribute correctly based on selectedValue', async () => {
        const page = await renderFunctionalComponentToSpecPage(() => h(NativeOptionFc, { value: "testValue", label: "testLabel", selectedValue: "testValue" }));
        expect(page.root).toMatchSnapshot();
        const option = page.root;
        expect(option === null || option === void 0 ? void 0 : option.hasAttribute('selected')).toBe(true);
    });
    it('should set selected attribute correctly based on selectedValue (with index as value)', async () => {
        const page = await renderFunctionalComponentToSpecPage(() => h(NativeOptionFc, { index: -1, value: "testValue", label: "testLabel", selectedValue: "testValue" }));
        expect(page.root).toMatchSnapshot();
        const option = page.root;
        expect(option === null || option === void 0 ? void 0 : option.hasAttribute('selected')).toBe(true);
    });
    it('should set selected attribute correctly based on selectedValue as number (with index as value)', async () => {
        const page = await renderFunctionalComponentToSpecPage(() => h(NativeOptionFc, { index: -1, value: 5, label: "testLabel", selectedValue: 5 }));
        expect(page.root).toMatchSnapshot();
        const option = page.root;
        expect(option === null || option === void 0 ? void 0 : option.hasAttribute('selected')).toBe(true);
    });
    it('should set selected attribute correctly based on selected prop', async () => {
        const page = await renderFunctionalComponentToSpecPage(() => h(NativeOptionFc, { value: "testValue", label: "testLabel", selected: true }));
        expect(page.root).toMatchSnapshot();
        const option = page.root;
        expect(option === null || option === void 0 ? void 0 : option.hasAttribute('selected')).toBe(true);
    });
});
//# sourceMappingURL=snapshot.test.js.map
