"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 faker_1 = __importDefault(require("faker"));
const test_utilities_1 = require("../../test-utilities");
const Heading_1 = require("../Heading");
const HeadingGroup_1 = require("../HeadingGroup");
const Section_1 = require("./Section");
describe('<Section />', () => {
    it('renders its children', () => {
        const children = faker_1.default.random.words();
        const section = test_utilities_1.mountWithContext(<Section_1.Section>{children}</Section_1.Section>);
        expect(section).toContainReactText(children);
    });
    it('wraps children with SectionContext of level 1', () => {
        const section = test_utilities_1.mountWithContext(<Section_1.Section />);
        expect(section).toProvideReactContext(Section_1.SectionContext, {
            level: 1,
        });
    });
    it('renders the Heading not wrapped in a HeadingGroup', () => {
        const heading = faker_1.default.random.words();
        const section = test_utilities_1.mountWithContext(<Section_1.Section>
        <Heading_1.Heading>{heading}</Heading_1.Heading>
      </Section_1.Section>);
        expect(section).not.toContainReactComponent(HeadingGroup_1.HeadingGroup);
        expect(section).toContainReactComponent(Heading_1.Heading, {
            children: heading,
        });
    });
    describe('nested <Section />', () => {
        it('renders the Heading wrapped in a HeadingGroup', () => {
            const heading = faker_1.default.random.words();
            const section = test_utilities_1.mountWithContext(<Section_1.Section>
          <Section_1.Section>
            <Heading_1.Heading>{heading}</Heading_1.Heading>
          </Section_1.Section>
        </Section_1.Section>);
            expect(section.find(HeadingGroup_1.HeadingGroup)).toContainReactComponent(Heading_1.Heading, {
                children: heading,
            });
        });
        it('wraps the nested Section children with SectionContext of level 2', () => {
            const children = faker_1.default.random.words();
            const section = test_utilities_1.mountWithContext(<Section_1.Section>
          <Section_1.Section>
            <Heading_1.Heading>{children}</Heading_1.Heading>
          </Section_1.Section>
        </Section_1.Section>);
            expect(section.find(Section_1.Section)).toProvideReactContext(Section_1.SectionContext, {
                level: 2,
            });
        });
    });
});
