From 6fcfb7c04d32e1c8b26a312295bf7ac3ec2d2ad7 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 13 Jul 2018 19:06:45 +0200 Subject: Fixed many permissions and began admin interface --- .../morris.js/spec/lib/hover_spec.coffee | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 public/bower_components/morris.js/spec/lib/hover_spec.coffee (limited to 'public/bower_components/morris.js/spec/lib/hover_spec.coffee') diff --git a/public/bower_components/morris.js/spec/lib/hover_spec.coffee b/public/bower_components/morris.js/spec/lib/hover_spec.coffee new file mode 100644 index 0000000..868f1a3 --- /dev/null +++ b/public/bower_components/morris.js/spec/lib/hover_spec.coffee @@ -0,0 +1,64 @@ +describe "Morris.Hover", -> + + describe "with dummy content", -> + + beforeEach -> + parent = $('
') + .appendTo($('#test')) + @hover = new Morris.Hover(parent: parent) + @element = $('#test .morris-hover') + + it "should initialise a hidden, empty popup", -> + @element.should.exist + @element.should.be.hidden + @element.should.be.empty + + describe "#show", -> + it "should show the popup", -> + @hover.show() + @element.should.be.visible + + describe "#hide", -> + it "should hide the popup", -> + @hover.show() + @hover.hide() + @element.should.be.hidden + + describe "#html", -> + it "should replace the contents of the element", -> + @hover.html('
Foobarbaz
') + @element.should.have.html('
Foobarbaz
') + + describe "#moveTo", -> + beforeEach -> + @hover.html('
') + + it "should place the popup directly above the given point", -> + @hover.moveTo(100, 150) + @element.should.have.css('left', '50px') + @element.should.have.css('top', '40px') + + it "should place the popup below the given point if it does not fit above", -> + @hover.moveTo(100, 50) + @element.should.have.css('left', '50px') + @element.should.have.css('top', '60px') + + it "should center the popup vertically if it will not fit above or below", -> + @hover.moveTo(100, 100) + @element.should.have.css('left', '50px') + @element.should.have.css('top', '40px') + + it "should center the popup vertically if no y value is supplied", -> + @hover.moveTo(100) + @element.should.have.css('left', '50px') + @element.should.have.css('top', '40px') + + describe "#update", -> + it "should update content, show and reposition the popup", -> + hover = new Morris.Hover(parent: $('#test')) + html = "
Hello, Everyone!
" + 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!') -- cgit v1.2.3