datavjs/test/lib.axis.js
2012-10-17 01:59:46 +08:00

35 lines
1013 B
JavaScript

module("Axis");
//4 new function tickAttr, tickTextAttr, minorTickAttr, domainAttr, others are belong to d3
//view xamples in ../examples/axis/ to know the usage.
var paper = Raphael(document.createElement("div"),900,100);
var x = d3.scale.linear().domain([0.05, 0.95]).range([0, 900]);
var axis = Axis().scale(x);
test("tickAttr", function () {
axis.tickAttr({"stroke": "#000"});
equal(axis.tickAttr().stroke, "#000", "tickAttr set and get ok");
});
test("tickTextAttr", function () {
axis.tickAttr({"font-size": "10px"});
equal(axis.tickAttr()["font-size"], "10px", "tickTextAttr set and get ok");
});
test("minorTickAttr", function () {
axis.tickAttr({"stroke": "#000"});
equal(axis.tickAttr().stroke, "#000", "minorTickAttr set and get ok");
});
test("domainAttr", function () {
axis.tickAttr({"stroke": "#000"});
equal(axis.tickAttr().stroke, "#000", "domainAttr set and get ok");
});
test("axis", function () {
ok(axis(paper), "axis ok");
});