RELEASE 🚒 : 1.0.2

Ability of specifying the "filename" of the downloaded CSV file .

```
 <CSVLink filename={"persons.csv"} data={data}>Click here</CSVLink>
```
This commit is contained in:
abdennour 2017-02-17 21:29:18 +03:00
commit d4544e117e
9 changed files with 4259 additions and 27 deletions

View file

@ -45,11 +45,19 @@ describe('CSVLink', () => {
expect(wrapper.props().separator).toEqual(',');
})
it(`assigns a download filename`, () => {
const filename= "persons.csv";
const wrapper = mount( <CSVLink {...minProps} filename={filename} > here </CSVLink>);
expect(wrapper.find('a').get(0).getAttribute('download')).toEqual(filename);
});
it(`renders anchor tag`, () => {
const wrapper = shallow( <CSVLink {...minProps} > Click here </CSVLink>);
expect(wrapper.find('a').length).toEqual(1);
});
it(`calls "buildURI" method on mounting`, () => {
const dataURI = `data:text/csv;some,thing`
const buildURI = sinon.stub(CSVLink.prototype, 'buildURI').returns(dataURI);