react-pikaday
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -59,3 +59,3 @@ /** @jsx React.DOM */ | ||
<p> | ||
<Pikaday linkedValue={this.linkState('date')} /> | ||
<Pikaday valueLink={this.linkState('date')} /> | ||
</p> | ||
@@ -62,0 +62,0 @@ <button onClick={() => { this.setState({date: null}); }}> |
{ | ||
"name": "react-pikaday", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A React component wrapper around Pikaday.", | ||
"main": "src/Pikaday.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/thomasboyt/react-pikaday.git" | ||
}, | ||
"dependencies": { | ||
"pikaday": "git://github.com/thomasboyt/pikaday#clear-field-on-falsy-setDate", | ||
"pikaday": "^1.2.0", | ||
"react": "^0.11.2" | ||
@@ -25,3 +28,7 @@ }, | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"reactify" | ||
] | ||
}, | ||
"scripts": { | ||
@@ -28,0 +35,0 @@ "test": "scripts/test", |
@@ -113,2 +113,35 @@ /** @jsx React.DOM */ | ||
}); | ||
describe('clearing the value', () => { | ||
it('works with LinkedStateMixin', function () { | ||
var Form = React.createClass({ | ||
mixins: [ React.addons.LinkedStateMixin ], | ||
getInitialState: function() { | ||
return { date: new Date(2014, 0, 1) }; | ||
}, | ||
render: function() { | ||
return ( | ||
<div> | ||
<Pikaday ref="pikaday" valueLink={this.linkState('date')} /> | ||
<button ref="clearBtn" | ||
onClick={() => this.setState({ date: null })}> | ||
Clear | ||
</button> | ||
</div> | ||
); | ||
} | ||
}); | ||
var component = React.renderComponent(<Form />, document.createElement('div')); | ||
var input = TU.findRenderedDOMComponentWithTag(component, 'input').getDOMNode(); | ||
expect(input.value).to.be.eql('2014-01-01'); | ||
var clearBtn = component.refs.clearBtn.getDOMNode(); | ||
TU.Simulate.click(clearBtn); | ||
expect(input.value).to.be.eql(''); | ||
}); | ||
}); | ||
}); |
@@ -1,3 +0,1 @@ | ||
/** @jsx React.DOM */ | ||
var React = require('react'); | ||
@@ -30,2 +28,6 @@ var Pikaday = require('pikaday'); | ||
if ( newTime !== prevTime ) { | ||
if ( newDate === null ) { | ||
// Workaround for pikaday not clearing value when date set to falsey | ||
this.refs.pikaday.getDOMNode().value = ''; | ||
} | ||
this._picker.setDate(newDate, true); // 2nd param = don't call onSelect | ||
@@ -32,0 +34,0 @@ } |
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable and can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
12226
300
0
0
+ Addedpikaday@1.8.2(transitive)
Updatedpikaday@^1.2.0