Skip to content

Commit

Permalink
Issue #552 card content (#958)
Browse files Browse the repository at this point in the history
* New structure for correct testing.

* Fixed index test.

* Adjusted naming.

* Imported component instead of radium export.
  • Loading branch information
IanCStewart authored and Sjaak Luthart committed Nov 10, 2017
1 parent 49fdfbf commit ac213b1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import Radium from 'radium';
import getStyles from './get-styles';

/** A Card is a piece of paper with unique related data */
Expand All @@ -23,4 +22,4 @@ CardContent.defaultProps = {
style: {}
};

export default Radium(CardContent);
export default CardContent;
4 changes: 4 additions & 0 deletions src/card-content/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Radium from 'radium';
import CardContent from './component';

export default Radium(CardContent);
14 changes: 7 additions & 7 deletions test/card-content/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import chai, { expect } from 'chai';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import CardContent from '../../src/card-content';
import CardContent from '../../src/card-content/component';
import getStyles from '../../src/card-content/get-styles';

chai.use(sinonChai);

describe('CardContent', () => {
const props = {
style: { root: true }
style: {}
};
const children = <p>children</p>;

Expand All @@ -24,16 +24,16 @@ describe('CardContent', () => {
global.navigator = undefined;
});

it('should always render a section element', () => {
const wrapper = shallow(<CardContent {...props}>{children}</CardContent>);
it('should render a section element', () => {
const component = shallow(<CardContent {...props}>{children}</CardContent>);

expect(wrapper.find('section')).to.have.length(1);
expect(component.find('section')).to.have.length(1);
});

it('should render children', () => {
const wrapper = shallow(<CardContent {...props}>{children}</CardContent>);
const component = shallow(<CardContent {...props}>{children}</CardContent>);

expect(wrapper.containsMatchingElement(<p>children</p>)).to.equal(true);
expect(component.containsMatchingElement(<p>children</p>)).to.equal(true);
});

it('should get root styles', () => {
Expand Down
8 changes: 4 additions & 4 deletions test/card/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ describe('Card', () => {
});

it('should render a section element', () => {
const wrapper = shallow(<Card {...props}>{children}</Card>);
const component = shallow(<Card {...props}>{children}</Card>);

expect(wrapper.find('section')).to.have.length(1);
expect(component.find('section')).to.have.length(1);
});

it('should render children', () => {
const wrapper = shallow(<Card {...props}>{children}</Card>);
const component = shallow(<Card {...props}>{children}</Card>);

expect(wrapper.containsMatchingElement(<p>children</p>)).to.equal(true);
expect(component.containsMatchingElement(<p>children</p>)).to.equal(true);
});

it('should get root styles', () => {
Expand Down

0 comments on commit ac213b1

Please sign in to comment.