aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org/speedometer/c3-master/spec/shape.bar-spec.js
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2015-04-02 19:24:45 +0200
committerKristian Lyngstol <kristian@bohemians.org>2015-04-02 19:24:45 +0200
commit0d8bba263dc195147d6fdb09662e7926f0a58b3e (patch)
tree4c570b4376c323e585120e7695b8715be7aa8881 /web/nms.gathering.org/speedometer/c3-master/spec/shape.bar-spec.js
parente4354b47bd8891c5b1ee591fdf74b3ca67eee461 (diff)
Bump lots of changes
Diffstat (limited to 'web/nms.gathering.org/speedometer/c3-master/spec/shape.bar-spec.js')
-rw-r--r--web/nms.gathering.org/speedometer/c3-master/spec/shape.bar-spec.js88
1 files changed, 88 insertions, 0 deletions
diff --git a/web/nms.gathering.org/speedometer/c3-master/spec/shape.bar-spec.js b/web/nms.gathering.org/speedometer/c3-master/spec/shape.bar-spec.js
new file mode 100644
index 0000000..78f2971
--- /dev/null
+++ b/web/nms.gathering.org/speedometer/c3-master/spec/shape.bar-spec.js
@@ -0,0 +1,88 @@
+var setMouseEvent = window.setMouseEvent;
+
+describe('c3 chart shape bar', function () {
+ 'use strict';
+
+ var chart, args;
+
+ beforeEach(function (done) {
+ chart = window.initChart(chart, args, done);
+ });
+
+ describe('internal.isWithinBar', function () {
+
+ describe('with normal axis', function () {
+
+ it('should update args', function () {
+ args = {
+ data: {
+ columns: [
+ ['data1', 30, 200, 100, 400, -150, 250],
+ ['data2', 50, 20, 10, 40, 15, 25],
+ ['data3', -150, 120, 110, 140, 115, 125]
+ ],
+ type: 'bar'
+ },
+ axis: {
+ rotated: false
+ }
+ };
+ expect(true).toBeTruthy();
+ });
+
+ it('should not be within bar', function () {
+ var bar = d3.select('.c3-target-data1 .c3-bar-0').node();
+ setMouseEvent(chart, 'click', 0, 0);
+ expect(chart.internal.isWithinBar(bar)).toBeFalsy();
+ });
+
+ it('should be within bar', function () {
+ var bar = d3.select('.c3-target-data1 .c3-bar-0').node();
+ setMouseEvent(chart, 'click', 31, 280);
+ expect(chart.internal.isWithinBar(bar)).toBeTruthy();
+ });
+
+ it('should not be within bar of negative value', function () {
+ var bar = d3.select('.c3-target-data3 .c3-bar-0').node();
+ setMouseEvent(chart, 'click', 68, 280);
+ expect(chart.internal.isWithinBar(bar)).toBeFalsy();
+ });
+
+ it('should be within bar of negative value', function () {
+ var bar = d3.select('.c3-target-data3 .c3-bar-0').node();
+ setMouseEvent(chart, 'click', 68, 350);
+ expect(chart.internal.isWithinBar(bar)).toBeTruthy();
+ });
+
+ });
+
+ describe('with rotated axis', function () {
+
+ it('should change the chart as axis rotated', function () {
+ args.axis.rotated = true;
+ expect(true).toBeTruthy();
+ });
+
+ it('should not be within bar', function () {
+ var bar = d3.select('.c3-target-data1 .c3-bar-0').node();
+ setMouseEvent(chart, 'click', 0, 0);
+ expect(chart.internal.isWithinBar(bar)).toBeFalsy();
+ });
+
+ it('should be within bar', function () {
+ var bar = d3.select('.c3-target-data1 .c3-bar-0').node();
+ setMouseEvent(chart, 'click', 190, 20);
+ expect(chart.internal.isWithinBar(bar)).toBeTruthy();
+ });
+
+ it('should be within bar of negative value', function () {
+ var bar = d3.select('.c3-target-data3 .c3-bar-0').node();
+ setMouseEvent(chart, 'click', 68, 50);
+ expect(chart.internal.isWithinBar(bar)).toBeTruthy();
+ });
+
+ });
+
+ });
+
+});