Fix some potential race conditions in tests.

Unless .html("") is called on d3.select("body"), elements appended by
another test could interfere with data binding.

See #329.
This commit is contained in:
Jason Davies 2011-10-08 00:09:59 +01:00
Родитель 9edd4bc058
Коммит b9db0585cb
3 изменённых файлов: 4 добавлений и 4 удалений

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

@ -11,7 +11,7 @@ module.exports = {
tt = [],
vv = [];
var s = d3.select("body").append("div").selectAll("div")
var s = d3.select("body").html("").append("div").selectAll("div")
.data(["red", "green"])
.enter().append("div")
.attr("color", function(d) { return d3.rgb(d)+""; });

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

@ -7,7 +7,7 @@ module.exports = {
"start": {
topic: function() {
var cb = this.callback,
div = d3.select("body").selectAll().data(["foo", "bar"]).enter().append("div").attr("class", String),
div = d3.select("body").html("").selectAll().data(["foo", "bar"]).enter().append("div").attr("class", String),
transition = div.transition().delay(150),
then = Date.now(),
n = 0,
@ -79,7 +79,7 @@ module.exports = {
"end": {
topic: function() {
var cb = this.callback,
div = d3.select("body").selectAll().data(["foo", "bar"]).enter().append("div").attr("class", String),
div = d3.select("body").html("").selectAll().data(["foo", "bar"]).enter().append("div").attr("class", String),
transition = div.transition().duration(150),
then = Date.now(),
n = 0,

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

@ -12,7 +12,7 @@ module.exports = {
vv = [],
fails = 0;
var s = d3.select("body").append("div").selectAll("div")
var s = d3.select("body").html("").append("div").selectAll("div")
.data(["red", "green"])
.enter().append("div")
.style("background-color", function(d) { return d3.rgb(d)+""; });