Skip to content

Commit

Permalink
Merge pull request #1517 from KleeGroup/develop
Browse files Browse the repository at this point in the history
Release 2.2.2
  • Loading branch information
Hartorn authored Nov 22, 2017
2 parents 441f0cc + a05cf5e commit a8aa7bf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
3 changes: 2 additions & 1 deletion jest-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
globals: {
__DEV__: true
__DEV__: true,
__IS_VERTIGO__: false
},
automock: false,
unmockedModulePathPatterns: [
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "focus-components",
"version": "2.2.1",
"version": "2.2.2",
"description": "Focus component repository.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -60,12 +60,12 @@
},
"homepage": "https://github.com/KleeGroup/focus-components",
"peerDependencies": {
"focus-core": "2.2.0",
"focus-core": ">= 2.2.0 < 2.3",
"material-design-lite": "1.3.0",
"moment": "2.18.1",
"react": "15.4.2",
"react-dom": "15.4.2",
"react-addons-css-transition-group": "15.4.2"
"react": ">= 15.4.2 < 16.0.0",
"react-dom": ">= 15.4.2 < 16.0.0",
"react-addons-css-transition-group": ">= 15.4.2 < 16.0.0"
},
"dependencies": {
"closest": "0.0.1",
Expand Down Expand Up @@ -93,4 +93,4 @@
"react-addons-test-utils": "15.4.2",
"react-dom": "15.4.2"
}
}
}
11 changes: 7 additions & 4 deletions src/common/mixin/store-behaviour.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ const storeMixin = {

/** @inheritdoc */
componentDidMount() {
const newState = this._getStateFromStores();
this.setState(newState);
if (this.stores && this.stores.length > 0) {
const newState = this._getStateFromStores();
this.setState(newState);
}
},

/** @inheritdoc */
Expand Down Expand Up @@ -58,7 +60,7 @@ const storeMixin = {
let defaultStateData = {};
// If there is a custom function, use it. It should return store-level data, with node.
if (this.getDefaultStoreData) {
defaultStateData = this.getDefaultStoreData(this.definition);
defaultStateData = this.getDefaultStoreData(this.definition, filterNodesArg);
} else if ((!hasFilter || this.definitionInNode) && this.definition) {
// If the information about store node is known, or we load all data from store
// We build the default data
Expand Down Expand Up @@ -124,7 +126,8 @@ const storeMixin = {
return this.buildEmptyFromDefinition();
}

return Object.keys(this.definition).reduce((acc, key) => ({ ...acc, [key]: null }), {});
return Object.keys(this.definition)
.reduce((acc, key) => ((__IS_VERTIGO__ || this.partialObject) && !this.refs[`${this.definitionPath}.${key}`] ? acc : { ...acc, [key]: null }), {});
},

/**
Expand Down
10 changes: 10 additions & 0 deletions src/components/input/select/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,24 @@ import TestUtils from 'react-addons-test-utils';
import React from 'react';
import ReactDOM from 'react-dom';

import { init } from 'focus-core/translation';

import Select from '../';

const { renderIntoDocument, Simulate } = TestUtils;
import identity from 'lodash/utility/identity';
import fixture from './fixture';
//onChangeSpy = jest.fn();

const i18nConfig = {
resources: {},
lng: 'fr-FR'///langOpts.i18nCulture
};

describe('The select ', () => {
beforeEach(() => {
init(i18nConfig);
});
describe('when called with no props', () => {
let component;
beforeEach(
Expand Down
3 changes: 2 additions & 1 deletion src/components/input/select/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//dependencies
import React, { Component, PropTypes } from 'react';
import { translate } from 'focus-core/translation';
import ComponentBaseBehaviour from '../../../behaviours/component-base';
import filterProps from '../../../utils/filter-html-attributes';
import isUndefined from 'lodash/lang/isUndefined';
Expand Down Expand Up @@ -120,7 +121,7 @@ class Select extends Component {
<select ref='htmlSelect' {...inputProps}>
{this._renderOptions(this.props)}
</select>
{error && <div className='label-error' ref='error'>{error}</div>}
{error && <div className='label-error' ref='error'>{translate(error)}</div>}
</div>
);
}
Expand Down

0 comments on commit a8aa7bf

Please sign in to comment.