forked from ReactTooltip/react-tooltip
-
Notifications
You must be signed in to change notification settings - Fork 1
/
globalMethods.test.js
38 lines (34 loc) · 1.05 KB
/
globalMethods.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* For Standard.js lint checking */
/* eslint-env mocha */
import React from 'react'
import { mount } from 'enzyme'
import { expect } from 'chai'
// import chaiEnzyme from 'chai-enzyme'
import sinon from 'sinon'
import ReactTooltip from '../src'
// Initial test tools
// @note chai enzyme has bug
// chai.use(chaiEnzyme())
describe.skip('Global methods', () => {
before(() => {
sinon.spy(ReactTooltip.prototype, 'hideTooltip')
sinon.spy(ReactTooltip.prototype, 'globalRebuild')
})
it('should be hided by invoking ReactTooltip.hide', done => {
const wrapper = mount(<ReactTooltip />)
wrapper.setState({ show: true })
ReactTooltip.hide()
setImmediate(() => {
expect(ReactTooltip.prototype.hideTooltip.calledOnce).to.equal(true)
expect(wrapper).to.have.state('show', false)
done()
})
})
it('should invoke globalRebuild when using ReactTooltip.rebuild', done => {
ReactTooltip.rebuild()
setImmediate(() => {
expect(ReactTooltip.prototype.globalRebuild.calledOnce).to.equal(true)
done()
})
})
})