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:
parent
c5053cf334
commit
d4544e117e
9 changed files with 4259 additions and 27 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue