admin-lte
Version:
Introduction ============
65 lines (52 loc) • 2.22 kB
text/coffeescript
describe "Morris.Hover", ->
describe "with dummy content", ->
beforeEach ->
parent = $('<div style="width:200px;height:180px"></div>')
.appendTo($('#test'))
it "should initialise a hidden, empty popup", ->
describe "#show", ->
it "should show the popup", ->
describe "#hide", ->
it "should hide the popup", ->
describe "#html", ->
it "should replace the contents of the element", ->
describe "#moveTo", ->
beforeEach ->
it "should place the popup directly above the given point", ->
it "should place the popup below the given point if it does not fit above", ->
it "should center the popup vertically if it will not fit above or below", ->
it "should center the popup vertically if no y value is supplied", ->
describe "#update", ->
it "should update content, show and reposition the popup", ->
hover = new Morris.Hover(parent: $('#test'))
html = "<div style='width:84px;height:84px'>Hello, Everyone!</div>"
hover.update(html, 150, 200)
el = $('#test .morris-hover')
el.should.have.css('left', '100px')
el.should.have.css('top', '90px')
el.should.have.text('Hello, Everyone!')