Skip to content

Commit 05747ff

Browse files
committed
Release 2.2.5
1 parent 3c92215 commit 05747ff

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

__tests__/input.jsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { mount } from 'enzyme';
3-
import FacebookProvider from '../src';
3+
import FacebookProvider, { Share } from '../src';
44

55
describe('Provider', () => {
66
it('should be able to create simple instance', () => {
@@ -12,4 +12,20 @@ describe('Provider', () => {
1212

1313
expect(wrapper.html()).toBe('<span>Test</span>');
1414
});
15+
16+
it('should be able to create simple instance', (done) => {
17+
const wrapper = mount(
18+
<FacebookProvider appID="123456789">
19+
<Share>
20+
<button type="button" onClick={done}>
21+
Test
22+
</button>
23+
</Share>
24+
</FacebookProvider>
25+
);
26+
27+
expect(wrapper.html()).toBe('<button type="button">Test</button>');
28+
29+
wrapper.find('button').first().simulate('click');
30+
});
1531
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-facebook",
3-
"version": "2.2.4",
3+
"version": "2.2.5",
44
"description": "Facebook components like a Login button, Like, Share, Comments or Embedded Post",
55
"author": {
66
"name": "Zlatko Fedor",

src/Share.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default class Share extends Component {
5555
}
5656

5757
@autobind
58-
handleClick(evn) {
58+
onClick(evn) {
5959
evn.preventDefault();
6060
evn.stopPropagation();
6161

@@ -71,13 +71,18 @@ export default class Share extends Component {
7171
const params = `status=0, width=${width}, height=${height}, top=${top}, left=${left}, toolbar=0, location=0, menubar=0, directories=0, scrollbars=0`;
7272

7373
window.open(href, 'sharer', params);
74+
75+
const { children } = this.props;
76+
if (children && children.props && children.props.onClick) {
77+
children.props.onClick(evn);
78+
}
7479
}
7580

7681
render() {
7782
const { children } = this.props;
7883

7984
return (
80-
React.cloneElement(children, { onClick: this.handleClick })
85+
React.cloneElement(children, { onClick: this.onClick })
8186
);
8287
}
8388
}

0 commit comments

Comments
 (0)