Skip to content

Commit

Permalink
Merge pull request #846 from Adslot/fix-commit
Browse files Browse the repository at this point in the history
fix: missing event injection commit
  • Loading branch information
lightbringer1991 authored May 7, 2019
2 parents 912d07c + 39a741f commit f53dd5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
6 changes: 3 additions & 3 deletions docs/examples/PopoverExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PopoverExample extends React.PureComponent {

handlePlacements = (state, placement) => this.setState({ placement });
handleThemes = (state, theme) => this.setState({ theme });
handleTriggers = (state, trigger) => this.setState({ trigger: state ? trigger : 'hover' });
handleTriggers = (state, trigger) => this.setState({ trigger });
togglePopover = () =>
this.setState(prevState => ({
isOpen: !prevState.isOpen,
Expand Down Expand Up @@ -112,7 +112,7 @@ class PopoverExample extends React.PureComponent {
<div className="auto-flip-container">
<div id="popover-boundaries" className="popover-example-container">
<Popover
trigger="disabled"
triggers="disabled"
isOpen={true}
placement="left"
title="Popover Title"
Expand Down Expand Up @@ -144,7 +144,7 @@ const exampleProps = {
// Non overflowing popover
<Popover
trigger="disabled"
triggers="disabled"
isOpen={true}
placement="left"
title="Popover Title"
Expand Down
10 changes: 5 additions & 5 deletions src/components/third-party/Popover/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ class Popover extends React.PureComponent {
{...(triggers.includes('disabled')
? {}
: {
onClick: triggers.includes('click') ? this.onClick : null,
onMouseOver: triggers.includes('hover') ? this.onMouseOver : null,
onFocus: triggers.includes('focus') ? this.onFocus : null,
onMouseOut: triggers.includes('hover') ? this.onMouseOut : null,
onBlur: triggers.includes('focus') ? this.onBlur : null,
...(triggers.includes('click') ? { onClick: this.onClick } : {}),
...(triggers.includes('hover')
? { onMouseOver: this.onMouseOver, onMouseOut: this.onMouseOut }
: {}),
...(triggers.includes('focus') ? { onFocus: this.onFocus, onBlur: this.onBlur } : {}),
})}
>
{children}
Expand Down
12 changes: 0 additions & 12 deletions src/components/third-party/Popover/index.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ describe('Popover Component', () => {
</Popover>
);
expect(wrapper.find('.aui--popover-element').prop('onClick')).to.be.a('function');
expect(wrapper.find('.aui--popover-element').prop('onMouseOver')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onFocus')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onMouseOut')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onBlur')).to.equal(null);
});

it('should register event handlers only for hover trigger', () => {
Expand All @@ -253,11 +249,8 @@ describe('Popover Component', () => {
Test message
</Popover>
);
expect(wrapper.find('.aui--popover-element').prop('onClick')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onMouseOver')).to.be.a('function');
expect(wrapper.find('.aui--popover-element').prop('onFocus')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onMouseOut')).to.be.a('function');
expect(wrapper.find('.aui--popover-element').prop('onBlur')).to.equal(null);
});

it('should register event handlers only for focus trigger', () => {
Expand All @@ -266,10 +259,7 @@ describe('Popover Component', () => {
Test message
</Popover>
);
expect(wrapper.find('.aui--popover-element').prop('onClick')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onMouseOver')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onFocus')).to.be.a('function');
expect(wrapper.find('.aui--popover-element').prop('onMouseOut')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onBlur')).to.be.a('function');
});

Expand All @@ -285,9 +275,7 @@ describe('Popover Component', () => {
</Popover>
);
expect(wrapper.find('.aui--popover-element').prop('onClick')).to.be.a('function');
expect(wrapper.find('.aui--popover-element').prop('onMouseOver')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onFocus')).to.be.a('function');
expect(wrapper.find('.aui--popover-element').prop('onMouseOut')).to.equal(null);
expect(wrapper.find('.aui--popover-element').prop('onBlur')).to.be.a('function');
});

Expand Down

0 comments on commit f53dd5d

Please sign in to comment.