import React from 'react';
import Collapse from '.';
import { createRendererWithUniDriver } from '../utils/test-utils/react';
import { collapsePrivateDriverFactory } from './test/Collapse.private.uni.driver';
describe('Collapse', () => {
    const render = createRendererWithUniDriver(collapsePrivateDriverFactory);
    it('should render', async () => {
        const { driver } = render(React.createElement(Collapse, null));
        expect(await driver.exists()).toBe(true);
    });
    it('should render children', () => {
        const { container } = render(React.createElement(Collapse, { children: "hello" }));
        expect(container.textContent).toEqual('hello');
    });
    describe('`open` prop', () => {
        it('should not render children when false', () => {
            const { container } = render(React.createElement(Collapse, { open: false, children: "hello" }));
            expect(container.textContent).toEqual('');
        });
        it('should be reported as false by testkit`s isOpen() when false', async () => {
            const { driver } = render(React.createElement(Collapse, { open: false, children: "hello" }));
            expect(await driver.isOpen()).toEqual(false);
        });
        it('should be reported as true by testkit`s isOpen() when true', async () => {
            const { driver } = render(React.createElement(Collapse, { open: true, children: "hello" }));
            expect(await driver.isOpen()).toEqual(true);
        });
    });
    describe('`dataHook` prop', () => {
        it('should be passed to children', () => {
            const hookForRoot = "I'm Hooked!";
            const hookOfChild = 'Leave britney alone!';
            const { container } = render(React.createElement(Collapse, { dataHook: hookForRoot, children: React.createElement("div", { "data-hook": hookOfChild }, "arbitrary content") }));
            expect(!!container.querySelector(`[data-hook="${hookOfChild}"]`)).toBe(true);
        });
    });
});
//# sourceMappingURL=Collapse.spec.js.map