diff --git a/jest-config.js b/jest-config.js index ce4d1f5d6..17cdd33b3 100644 --- a/jest-config.js +++ b/jest-config.js @@ -1,6 +1,7 @@ module.exports = { globals: { - __DEV__: true + __DEV__: true, + __IS_VERTIGO__: false }, automock: false, unmockedModulePathPatterns: [ diff --git a/package.json b/package.json index 8d785b424..f5c3b87f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "focus-components", - "version": "2.2.1", + "version": "2.2.2", "description": "Focus component repository.", "main": "index.js", "scripts": { @@ -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", @@ -93,4 +93,4 @@ "react-addons-test-utils": "15.4.2", "react-dom": "15.4.2" } -} \ No newline at end of file +} diff --git a/src/common/mixin/store-behaviour.js b/src/common/mixin/store-behaviour.js index 4378c8be9..f76491723 100644 --- a/src/common/mixin/store-behaviour.js +++ b/src/common/mixin/store-behaviour.js @@ -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 */ @@ -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 @@ -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 }), {}); }, /** diff --git a/src/components/input/select/__tests__/index.js b/src/components/input/select/__tests__/index.js index a6189bf90..0c9574ca7 100644 --- a/src/components/input/select/__tests__/index.js +++ b/src/components/input/select/__tests__/index.js @@ -3,6 +3,8 @@ 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; @@ -10,7 +12,15 @@ 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( diff --git a/src/components/input/select/index.js b/src/components/input/select/index.js index 5832bc4eb..a3bcc86a1 100644 --- a/src/components/input/select/index.js +++ b/src/components/input/select/index.js @@ -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'; @@ -120,7 +121,7 @@ class Select extends Component { - {error &&