Skip to content

Commit

Permalink
Better test for automatic tick precision.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jul 31, 2013
1 parent dddef32 commit c247e16
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/scale/linear-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ suite.addBatch({
}
},

"tickFormat": {
"applies automatic precision when not explicitly specified": function(d3) {
var x = d3.scale.linear();
assert.strictEqual(x.tickFormat(10, "f")(Math.PI), "3.1")
assert.strictEqual(x.tickFormat(100, "f")(Math.PI), "3.14");
assert.strictEqual(x.tickFormat(100, "$f")(Math.PI), "$3.14");
assert.strictEqual(x.domain([0, 100]).tickFormat(100, "%")(Math.PI), "314%");
}
},

"nice": {
"nices the domain, extending it to round numbers": function(d3) {
var x = d3.scale.linear().domain([1.1, 10.9]).nice();
Expand Down

0 comments on commit c247e16

Please sign in to comment.