Coverage 100% 😎 🤗

This commit is contained in:
abdennour 2016-11-26 09:40:58 +03:00
commit bbddab3c80
5 changed files with 142 additions and 4 deletions

View file

@ -8,13 +8,19 @@ const defaultProps = {
class CSVDownload extends React.Component {
constructor(props) {
super(props);
this.state={};
}
buildURI() {
return buildURI(...arguments);
}
componentDidMount(){
this.page = window.open(buildURI(this.props.data, this.props.headers), this.props.target, this.props.specs, this.props.replace);
this.state.page = window.open(this.buildURI(this.props.data, this.props.headers), this.props.target, this.props.specs, this.props.replace);
}
getWindow() {
return this.page;
return this.state.page;
}
render(){

View file

@ -6,12 +6,17 @@ import XObject from 'x-object/safe';
class CSVLink extends React.Component {
constructor(props) {
super(props);
this.buildURI= this.buildURI.bind(this);
}
buildURI() {
return buildURI(...arguments);
}
render(){
return (
<a {...XObject.filter(this.props, (k, v) => !PropsNotForwarded.includes(k))}
href={buildURI(this.props.data, this.props.headers)}>
href={this.buildURI(this.props.data, this.props.headers)}>
{this.props.children}
</a>
)