diff --git a/src/Menu/Menu.spec.js b/src/Menu/Menu.spec.js index 7c0ba7ea039ef1..2e22d8f7d77f9e 100644 --- a/src/Menu/Menu.spec.js +++ b/src/Menu/Menu.spec.js @@ -269,12 +269,12 @@ describe('
', () => { ); - wrapper.find('.item1').simulate('click'); + wrapper.find('.item1').simulate('touchTap'); assert.strictEqual(wrapper.state('focusIndex'), 0); document.body.dispatchEvent(new window.Event('mouseup', {bubbles: true})); assert.strictEqual(wrapper.state('focusIndex'), -1); - wrapper.find('.item2').simulate('click'); + wrapper.find('.item2').simulate('touchTap'); assert.strictEqual(wrapper.state('focusIndex'), 1); document.body.dispatchEvent(new window.Event('mouseup', {bubbles: true})); assert.strictEqual(wrapper.state('focusIndex'), 1); diff --git a/src/Popover/Popover.js b/src/Popover/Popover.js index 6897294cd906bf..d78cfa499dfb51 100644 --- a/src/Popover/Popover.js +++ b/src/Popover/Popover.js @@ -130,8 +130,6 @@ class Popover extends Component { this.handleResize = throttle(this.setPlacement, 100); this.handleScroll = throttle(this.setPlacement.bind(this, true), 50); - this.popoverRefs = {}; - this.state = { open: props.open, closing: false, @@ -139,7 +137,7 @@ class Popover extends Component { } componentDidMount() { - this.placementTimeout = setTimeout(this.setPlacement); + this.setPlacement(); } componentWillReceiveProps(nextProps) { @@ -175,19 +173,13 @@ class Popover extends Component { } componentDidUpdate() { - clearTimeout(this.placementTimeout); - this.placementTimeout = setTimeout(this.setPlacement); + this.setPlacement(); } componentWillUnmount() { this.handleResize.cancel(); this.handleScroll.cancel(); - if (this.placementTimeout) { - clearTimeout(this.placementTimeout); - this.placementTimeout = null; - } - if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; @@ -293,11 +285,11 @@ class Popover extends Component { return; } - if (!this.popoverRefs.layer.getLayer()) { + if (!this.refs.layer.getLayer()) { return; } - const targetEl = this.popoverRefs.layer.getLayer().children[0]; + const targetEl = this.refs.layer.getLayer().children[0]; if (!targetEl) { return; } @@ -418,7 +410,7 @@ class Popover extends Component { onResize={this.handleResize} />