"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const dom_1 = require("@quilted/react-testing/dom");
const faker_1 = __importDefault(require("faker"));
const View_1 = require("./View");
describe('<View />', () => {
    describe('children', () => {
        it('renders its children', () => {
            const text = 'Snowdevil';
            const view = dom_1.mount(<View_1.View>{text} </View_1.View>);
            expect(view).toContainReactText(text);
        });
    });
    describe('id', () => {
        it('sets id when id is set', () => {
            const id = faker_1.default.random.uuid();
            const view = dom_1.mount(<View_1.View id={id}/>);
            expect(view).toContainReactComponent('div', {
                id,
            });
        });
    });
    describe('role', () => {
        it('renders a div by default', () => {
            const text = 'Snowdevil';
            const view = dom_1.mount(<View_1.View>{text} </View_1.View>);
            expect(view).toContainReactComponent('div');
        });
        it('renders a section when "region" is set', () => {
            const view = dom_1.mount(<View_1.View role="region"/>);
            expect(view).toContainReactComponent('section');
        });
        it('renders an aside when "complimentary" is set', () => {
            const view = dom_1.mount(<View_1.View role="complementary"/>);
            expect(view).toContainReactComponent('aside');
        });
    });
    describe('accessibilityVisibility', () => {
        it('sets aria-hidden to true when accessibilityVisibility is set', () => {
            const text = 'Snowdevil';
            const view = dom_1.mount(<View_1.View accessibilityVisibility="hidden">{text} </View_1.View>);
            expect(view).toContainReactComponent('div', { 'aria-hidden': true });
        });
        it('does not set aria-hidden when accessibilityVisibility is not set', () => {
            const text = 'Snowdevil';
            const view = dom_1.mount(<View_1.View>{text} </View_1.View>);
            expect(view).toContainReactComponent('div', { 'aria-hidden': undefined });
        });
    });
    describe('accessibilityLabel', () => {
        it('sets aria-label with accessibilityLabel if role is set', () => {
            const text = faker_1.default.random.words();
            const view = dom_1.mount(<View_1.View accessibilityLabel={text} role="region"/>);
            expect(view).toContainReactComponent('section', { 'aria-label': text });
        });
        it('does not set aria-label if role is not set', () => {
            const text = faker_1.default.random.words();
            const view = dom_1.mount(<View_1.View accessibilityLabel={text}/>);
            expect(view).not.toContainReactComponent('div', { 'aria-label': text });
        });
    });
});
