Skip to content

Commit

Permalink
Merge pull request #232 from Adslot/upgrade-alexandria-and-expose-cov…
Browse files Browse the repository at this point in the history
…erage

chore: upgrade deps, fix build errors, increase coverage
  • Loading branch information
tchcxp committed Jun 1, 2016
2 parents 8ef8e5b + 60d00e0 commit f92b9da
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 15 deletions.
1 change: 1 addition & 0 deletions cfg/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
cheerio: 'window',
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'react/addons': true,
},
module: {
loaders: [
Expand Down
22 changes: 11 additions & 11 deletions dist/adslot-ui-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/adslot-ui.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = function configureKarma(config) {
reporters: [
{ type: 'lcov', subdir: '.' },
{ type: 'json', subdir: '.' },
{ type: 'text-summary', subdir: '.' },
],
},
webpack: webpackCfg,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"author": "Adslot",
"devDependencies": {
"alexandria-adslot": "^2.7.0",
"alexandria-adslot": "^2.8.0",
"autoprefixer": "^6.3.4",
"babel-core": "^6.7.2",
"babel-eslint": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/examples/components/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ ExampleForm.propTypes = {
validateAndSave: PropTypes.func.isRequired,
};

const mapStateToProps = (state) => ({
export const mapStateToProps = (state) => ({
formValues: state.form,
isSubmitting: state.visibility.isSubmitting,
});
Expand Down
5 changes: 5 additions & 0 deletions test/components/MainTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ describe('MainComponent', () => {
expect(listPickerElement.prop('labelFormatter')({ givenName: 'John', surname: 'Doe' })).to.equal('John Doe');
});

it('should pass a custom controllerFormatter into the ListPicker', () => {
const listPickerElement = MainComponent.find(ListPicker).first();
expect(listPickerElement.prop('controllerFormatter')().type).to.equal(Checkbox);
});

it('should pass a custom initialSelection into the ListPicker', () => {
const listPickerElement = MainComponent.find(ListPicker).first();
expect(listPickerElement.prop('initialSelection')).to.have.length(1);
Expand Down
13 changes: 12 additions & 1 deletion test/examples/components/formsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import React from 'react';
import sinon from 'sinon';
import { Button, PageTitle, Select, Checkbox } from 'components/distributionEntry';
import { ExampleFormPure } from 'examples/components/forms';
import { ExampleFormPure, mapStateToProps } from 'examples/components/forms';
import { shallow } from 'enzyme';

describe('ExampleForm', () => {
Expand Down Expand Up @@ -96,4 +96,15 @@ describe('ExampleForm', () => {

expect(mockValidateAndSave.calledOnce).to.equal(true);
});

it('should map state to props', () => {
const state = {
form: { foo: 'bar' },
visibility: { isSubmitting: true },
};
expect(mapStateToProps(state)).to.deep.equal({
formValues: { foo: 'bar' },
isSubmitting: true,
});
});
});
16 changes: 16 additions & 0 deletions test/examples/components/selectsTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { Select } from 'components/distributionEntry';
import ExampleSelect from 'examples/components/selects';
import { shallow } from 'enzyme';

describe('ExampleSelect', () => {
it('should render two react-select components with defaults', () => {
const component = shallow(<ExampleSelect />);
const selectComponents = component.find(Select);
expect(selectComponents).to.have.length(2);
expect(selectComponents.first().prop('clearable')).to.equal(false);
expect(selectComponents.first().prop('name')).to.equal('countriesSelect');
expect(selectComponents.last().prop('clearable')).to.equal(true);
expect(selectComponents.last().prop('name')).to.equal('flavoursSelect');
});
});

0 comments on commit f92b9da

Please sign in to comment.