From 9283b97d35a6f35eb1eaddec23646c40206b9dd4 Mon Sep 17 00:00:00 2001 From: Gordon Woodhull Date: Wed, 27 Jul 2016 15:20:43 -0400 Subject: [PATCH] add infinity test for #1177 --- Changelog.md | 1 + spec/number-display-spec.js | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Changelog.md b/Changelog.md index ffc1e1db3..6a043e55e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ * Do not allow pie slices to overlap pie labels, by Michael Dougherty ([#664](https://github.com/dc-js/dc.js/issues/664) / [#1167](https://github.com/dc-js/dc.js/pull/1167)) * Highlight pie slices when hovering labels and paths. (addressing a concern raised in commit [0a35ef61](https://github.com/dc-js/dc.js/pull/1167/commits/0a35ef61568baf8e84e0bc489f678df560dc7f31) in PR [#1167](https://github.com/dc-js/dc.js/pull/1167), but in a more robust way) * Transition dots in line chart, by Paul Mach ([#1181](https://github.com/dc-js/dc.js/pull/1181)) +* Number display was getting stuck on Infinity, by Xaser Acheron ([#1176](https://github.com/dc-js/dc.js/issues/1176) / [#1177](https://github.com/dc-js/dc.js/pull/1177)) ## 2.0.0 beta 31 * Brush was sometimes not displaying, fix by Paul Briton ([#1134](https://github.com/dc-js/dc.js/issues/1134)) diff --git a/spec/number-display-spec.js b/spec/number-display-spec.js index d7fbe7887..904456963 100644 --- a/spec/number-display-spec.js +++ b/spec/number-display-spec.js @@ -165,4 +165,30 @@ describe('dc.numberDisplay', function () { d3.select('#number-display-test-section').remove(); }); }); + describe('Infinity', function () { + var chart; + beforeEach(function () { + var id = 'empty-div'; + appendChartID(id); + chart = buildChart('#' + id); + chart.valueAccessor(function (x) { return x; }) + .group({value: function () { return Infinity; }}) + .formatNumber(function (d) { return d; }) + .render(); + d3.timer.flush(); + }); + it('should display as Infinity', function () { + expect(chart.root().text()).toEqual('Infinity'); + }); + describe('returning to finite', function () { + beforeEach(function () { + chart.group({value: function () { return 17; }}) + .render(); + d3.timer.flush(); + }); + it('should display finite', function () { + expect(chart.root().text()).toEqual('17'); + }); + }); + }); });