henrybuilt-react-library
Advanced tools
Comparing version 1.0.39 to 1.0.40
{ | ||
"name": "henrybuilt-react-library", | ||
"version": "1.0.39", | ||
"version": "1.0.40", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "maxhudson", |
@@ -34,3 +34,3 @@ import {_, Component, PropTypes} from 'components'; | ||
var constrainedValue = this.constrain(value); | ||
var valueWasConstrained = !_.isEqual(value, constrainedValue); | ||
var valueWasConstrained = value != constrainedValue; //HINT intentional use of type unsafe comparison to compare numbers and strings | ||
var shouldTriggerChange = (this.props.triggerChangeOnClean && !_.isEqual(constrainedValue, this.props.value)) || !_.isEqual(value, this.props.value); | ||
@@ -37,0 +37,0 @@ |
@@ -79,3 +79,8 @@ import {_, React, Component} from 'components'; | ||
constrain(value) { | ||
if (typeof(value) !== 'string') value = ''; | ||
if (typeof(value) === 'number') { | ||
value = `${value}`; | ||
} | ||
else if (typeof(value) !== 'string') { | ||
value = ''; | ||
} | ||
@@ -82,0 +87,0 @@ return value; |
@@ -56,2 +56,9 @@ import {React, Component, mount} from 'test'; | ||
expect(wrapper.find(Form).state().textInputValue).toEqual('12'); | ||
expect(wrapper.find(TextInput).props().value).toEqual('12'); | ||
expect(wrapper.find('input').props().value).toEqual('12'); | ||
wrapper.find('input').simulate('change', {target: {value: [1, 2, 3]}}); | ||
wrapper.find('input').simulate('blur'); | ||
expect(wrapper.find(Form).state().textInputValue).toEqual(''); | ||
@@ -58,0 +65,0 @@ expect(wrapper.find(TextInput).props().value).toEqual(''); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12565181
144192