-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated tootlip to append to body and to display within a container, c…
…loses #299, removed k4tip from column chart layout, added basic tests for tooltip
- Loading branch information
Juan Thomassie
committed
Sep 16, 2014
1 parent
af355dd
commit cee548a
Showing
5 changed files
with
170 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
define(function (require) { | ||
var angular = require('angular'); | ||
var _ = require('lodash'); | ||
var $ = require('jquery'); | ||
|
||
angular.module('TooltipFactory', ['kibana']); | ||
|
||
describe('Vislib Tooltip', function () { | ||
var Tooltip; | ||
var bars; | ||
var tip; | ||
var el; | ||
var chart; | ||
|
||
var data = [ | ||
{ | ||
x: 10, | ||
y: 8 | ||
}, | ||
{ | ||
x: 11, | ||
y: 23 | ||
}, | ||
{ | ||
x: 12, | ||
y: 30 | ||
}, | ||
{ | ||
x: 13, | ||
y: 28 | ||
}, | ||
{ | ||
x: 14, | ||
y: 36 | ||
}, | ||
{ | ||
x: 15, | ||
y: 30 | ||
} | ||
]; | ||
|
||
beforeEach(function () { | ||
module('TooltipFactory'); | ||
}); | ||
|
||
beforeEach(function () { | ||
inject(function (d3, Private) { | ||
Tooltip = Private(require('components/vislib/lib/tooltip')); | ||
|
||
el = d3.select('body') | ||
.append('div') | ||
.attr('class', 'vis-col-wrapper') | ||
.style('width', '40px') | ||
.style('height', '40px'); | ||
|
||
tip = new Tooltip(el[0][0], function (d) { | ||
return 'd.x: ' + d.x + ', d.y: ' + d.y; | ||
}); | ||
|
||
chart = el.append('div').attr('class', 'chart'); | ||
el.append('div').attr('class', 'y-axis-col-wrapper'); | ||
el.append('div').attr('class', 'k4tip'); | ||
|
||
bars = chart.selectAll('div') | ||
.data(data) | ||
.enter() | ||
.append('div') | ||
.attr('class', 'bars') | ||
.style('width', function (d) { | ||
return d.y; | ||
}) | ||
.style('height', '10px') | ||
.text(function (d) { | ||
return d.y; | ||
}); | ||
|
||
bars.call(tip.render()); | ||
|
||
// d3.select('.bars').on('mousemove.tip')(d3.select('.bars').node().__data__, 0); | ||
}); | ||
|
||
|
||
|
||
}); | ||
|
||
afterEach(function () { | ||
el.remove(); | ||
}); | ||
|
||
it('should be an object', function () { | ||
expect(_.isObject(Tooltip)).to.be(true); | ||
}); | ||
|
||
it('should return a function', function () { | ||
expect(typeof Tooltip).to.be('function'); | ||
}); | ||
}); | ||
|
||
}); |