This commit is contained in:
Mike Bostock 2011-08-14 13:07:20 -07:00
Родитель 03253fcff6
Коммит 3a5a6c6c0d
3 изменённых файлов: 44 добавлений и 24 удалений

Просмотреть файл

@ -1,18 +0,0 @@
require("./../../lib/env-js/envjs/node");
require("./../../lib/sizzle/sizzle");
require("./../../d3");
var body = d3.select("body")
.style("background-color", "white");
console.log("transition start:");
console.log(" ", body.style("background-color"));
console.log("");
body.transition()
.style("background-color", "red")
.each("end", function() {
console.log("transition end:");
console.log(" ", body.style("background-color"));
console.log("");
});

Просмотреть файл

@ -1,6 +0,0 @@
transition start:
white
transition end:
rgb(255,0,0)

Просмотреть файл

@ -0,0 +1,44 @@
require("../env");
require("../../d3");
var vows = require("vows"),
assert = require("assert");
var suite = vows.describe("d3.transition");
suite.addBatch({
"transition.style": {
topic: function() {
var callback = this.callback,
div = d3.select("body").append("div");
div
.style("background-color", "white")
.transition()
.style("background-color", "red")
.each("end", function() { callback(null, div); });
},
"sets a property as a string": function(div) {
assert.equal(div.style("background-color"), "rgb(255,0,0)");
}
},
"transition.attr": {
topic: function() {
var callback = this.callback,
div = d3.select("body").append("div");
div
.attr("width", 20)
.transition()
.attr("width", 200)
.each("end", function() { callback(null, div); });
},
"sets an attribute as a number": function(div) {
assert.equal(div.attr("width"), "200");
}
}
});
// TODO There's a lot more to test here!
suite.export(module);