forked from nicgirault/circosJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestTooltip.coffee
32 lines (26 loc) · 1.03 KB
/
testTooltip.coffee
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
describe '[behavior] Tooltip', ->
describe '{unit} registerTooltip', ->
track = null
element = null
beforeEach ->
track =
dispatch: d3.dispatch('mouseover', 'mouseout')
element =
call: -> return
sinon.spy(element, 'call')
it 'should call tooltip.show on mouseover', ->
circosJS._registerTooltip(track, element, {})
sinon.stub(track.tip, 'attr').returns(track.tip)
sinon.stub(track.tip, 'show')
track.dispatch.mouseover({}, 0, 0)
expect(track.tip.show.calledWith({}, 0, 0)).to.be.true
it 'should call tooltip.hide on mouseout', ->
circosJS._registerTooltip(track, element, {})
sinon.stub(track.tip, 'attr').returns(track.tip)
sinon.stub(track.tip, 'show')
sinon.stub(track.tip, 'hide')
track.dispatch.mouseout({}, 0, 0)
expect(track.tip.hide.calledOnce).to.be.true
it 'should register the tooltip on element', ->
circosJS._registerTooltip(track, element, {})
expect(element.call.calledWith(track.tip)).to.be.true