Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should render with props', () => {
const wrapper = shallow(
{panel1.content}
{panel2.content}
{panel3.content}
);
const cardElement = wrapper.find(Card.Content);
expect(cardElement).to.have.length(1);
const panelElements = cardElement.find(Accordion.Panel);
expect(panelElements).to.have.length(3);
const panelElement1 = panelElements.at(0);
expect(panelElement1.prop('id')).to.equal('1');
expect(panelElement1.prop('onClick')).to.be.a('function');
const panelElement2 = panelElements.at(1);
expect(panelElement2.prop('id')).to.equal('2');
expect(panelElement2.prop('onClick')).to.be.a('function');
const panelElement3 = panelElements.at(2);
expect(panelElement3.prop('id')).to.equal('3');
expect(panelElement3.prop('onClick')).to.be.a('function');
expect(panelElement3.prop('dts')).to.equal('panel-3'); // should generate a dts from panel id
});
it('should render with props', () => {
const wrapper = shallow(
{panel1.content}
{panel2.content}
{panel3.content}
);
const cardElement = wrapper.find(Card.Content);
expect(cardElement).to.have.length(1);
const panelElements = cardElement.find(Accordion.Panel);
expect(panelElements).to.have.length(3);
const panelElement1 = panelElements.at(0);
expect(panelElement1.prop('id')).to.equal('1');
expect(panelElement1.prop('onClick')).to.be.a('function');
const panelElement2 = panelElements.at(1);
expect(panelElement2.prop('id')).to.equal('2');
expect(panelElement2.prop('onClick')).to.be.a('function');
const panelElement3 = panelElements.at(2);
expect(panelElement3.prop('id')).to.equal('3');
expect(panelElement3.prop('onClick')).to.be.a('function');
it('should render with defaults', () => {
const wrapper = shallow(
{panel1.content}
);
const cardElement = wrapper.find(Card.Content);
expect(cardElement).to.have.length(1);
expect(cardElement.children()).to.have.length(1);
});
it('should re-render on specified attribute change one level deep', () => {
const GridFast = fastStatelessWrapper(Grid, ['mutable']);
const props = {
mutable: {
one: true,
},
fixed: 'bar',
};
const nextProps = {
mutable: {
one: false,
},
fixed: 'bar',
};
const shallowRenderer = shallow();
const shouldUpdate = shallowRenderer.instance().shouldComponentUpdate(nextProps);
expect(shouldUpdate).to.equal(true);
});
{panel1.content}
{panel2.content}
{panel3.content}
);
wrapper
.find(Accordion.Panel)
.at(0)
.find('.panel-component-header')
.simulate('click');
expect(
wrapper
.find(Accordion.Panel)
.at(0)
.prop('isCollapsed')
).to.equal(true);
});