react-facebook
Advanced tools
Comparing version 2.2.4 to 2.2.5
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import FacebookProvider from '../src'; | ||
import FacebookProvider, { Share } from '../src'; | ||
@@ -15,2 +15,18 @@ describe('Provider', () => { | ||
}); | ||
it('should be able to create simple instance', (done) => { | ||
const wrapper = mount( | ||
<FacebookProvider appID="123456789"> | ||
<Share> | ||
<button type="button" onClick={done}> | ||
Test | ||
</button> | ||
</Share> | ||
</FacebookProvider> | ||
); | ||
expect(wrapper.html()).toBe('<button type="button">Test</button>'); | ||
wrapper.find('button').first().simulate('click'); | ||
}); | ||
}); |
@@ -101,3 +101,3 @@ 'use strict'; | ||
Share.prototype.handleClick = function handleClick(evn) { | ||
Share.prototype.onClick = function onClick(evn) { | ||
evn.preventDefault(); | ||
@@ -121,2 +121,8 @@ evn.stopPropagation(); | ||
window.open(href, 'sharer', params); | ||
var children = this.props.children; | ||
if (children && children.props && children.props.onClick) { | ||
children.props.onClick(evn); | ||
} | ||
}; | ||
@@ -128,3 +134,3 @@ | ||
return _react2.default.cloneElement(children, { onClick: this.handleClick }); | ||
return _react2.default.cloneElement(children, { onClick: this.onClick }); | ||
}; | ||
@@ -151,3 +157,3 @@ | ||
icon: true | ||
}, _temp), (_applyDecoratedDescriptor(_class.prototype, 'handleClick', [_coreDecorators.autobind], Object.getOwnPropertyDescriptor(_class.prototype, 'handleClick'), _class.prototype)), _class); | ||
}, _temp), (_applyDecoratedDescriptor(_class.prototype, 'onClick', [_coreDecorators.autobind], Object.getOwnPropertyDescriptor(_class.prototype, 'onClick'), _class.prototype)), _class); | ||
exports.default = Share; |
{ | ||
"name": "react-facebook", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"description": "Facebook components like a Login button, Like, Share, Comments or Embedded Post", | ||
@@ -5,0 +5,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76710
1636