import * as React from 'react';
import { mount } from 'enzyme';
import Panel from '../Panel';
import Video, { VideoType } from '../../Video';
describe('', () => {
const theme = {
panel: 'thm-pnl',
heading: 'thm-hdr',
body: 'thm-body',
};
const videoCmp = ;
describe('when default props are provided', () => {
it('panel should be rendered with default props', () => {
const subject = mount();
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
});
});
describe('heading property', () => {
describe('when set as string', () => {
it('panel should have header', () => {
const subject = mount();
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
});
});
describe('when set as react component', () => {
const headCmp =
Panel
;
it('panel should have header', () => {
const subject = mount();
expect(subject.find('div')).toHaveLength(2);
expect(subject.find('h3').text()).toBe('Panel');
});
});
});
describe('video property', () => {
describe('when not set', () => {
it('panel should not have video', () => {
const subject = mount();
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
expect(subject.find('div').at(2).children()).toHaveLength(0);
});
});
describe('when set', () => {
it('panel should have video', () => {
const subject = mount();
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel with Video');
expect(subject.find('div').at(2).children().html()).toBe('');
});
});
});
describe('children property', () => {
describe('when not set', () => {
it('panel should render without children container', () => {
const subject = mount();
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
expect(subject.find('div').at(2).children()).toHaveLength(0);
});
});
describe('when set', () => {
it('panel should render children', () => {
const subject = mount(This is a paragraph!
);
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
expect(subject.find('div').at(2).children().html()).toBe('This is a paragraph!
');
});
});
});
describe('theme property', () => {
describe('when not set', () => {
it('panel should render without theme css', () => {
const subject = mount();
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
expect(subject.html()).toBe('');
});
});
describe('when set', () => {
it('panel should render theme css', () => {
const subject = mount(ABC);
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
expect(subject.find('div').at(0).hasClass('thm-pnl')).toBe(true);
expect(subject.find('div').at(1).hasClass('thm-hdr')).toBe(true);
expect(subject.find('div').at(2).hasClass('thm-body')).toBe(true);
});
});
});
describe('all property', () => {
describe('when set', () => {
it('panel should render using all props', () => {
const subject = mount(test
);
expect(subject.find('div')).toHaveLength(3);
expect(subject.find('div').at(1).text()).toBe('Panel');
expect(subject.find('div').at(2).children()).toHaveLength(2);
expect(subject.find('div').at(2).html()).toBe('');
expect(subject.find('div').at(0).hasClass('thm-pnl')).toBe(true);
expect(subject.find('div').at(1).hasClass('thm-hdr')).toBe(true);
expect(subject.find('div').at(2).hasClass('thm-body')).toBe(true);
});
});
});
});