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:
Родитель
9edd4bc058
Коммит
b9db0585cb
|
@ -11,7 +11,7 @@ module.exports = {
|
||||||
tt = [],
|
tt = [],
|
||||||
vv = [];
|
vv = [];
|
||||||
|
|
||||||
var s = d3.select("body").append("div").selectAll("div")
|
var s = d3.select("body").html("").append("div").selectAll("div")
|
||||||
.data(["red", "green"])
|
.data(["red", "green"])
|
||||||
.enter().append("div")
|
.enter().append("div")
|
||||||
.attr("color", function(d) { return d3.rgb(d)+""; });
|
.attr("color", function(d) { return d3.rgb(d)+""; });
|
||||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
||||||
"start": {
|
"start": {
|
||||||
topic: function() {
|
topic: function() {
|
||||||
var cb = this.callback,
|
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),
|
transition = div.transition().delay(150),
|
||||||
then = Date.now(),
|
then = Date.now(),
|
||||||
n = 0,
|
n = 0,
|
||||||
|
@ -79,7 +79,7 @@ module.exports = {
|
||||||
"end": {
|
"end": {
|
||||||
topic: function() {
|
topic: function() {
|
||||||
var cb = this.callback,
|
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),
|
transition = div.transition().duration(150),
|
||||||
then = Date.now(),
|
then = Date.now(),
|
||||||
n = 0,
|
n = 0,
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = {
|
||||||
vv = [],
|
vv = [],
|
||||||
fails = 0;
|
fails = 0;
|
||||||
|
|
||||||
var s = d3.select("body").append("div").selectAll("div")
|
var s = d3.select("body").html("").append("div").selectAll("div")
|
||||||
.data(["red", "green"])
|
.data(["red", "green"])
|
||||||
.enter().append("div")
|
.enter().append("div")
|
||||||
.style("background-color", function(d) { return d3.rgb(d)+""; });
|
.style("background-color", function(d) { return d3.rgb(d)+""; });
|
||||||
|
|
Загрузка…
Ссылка в новой задаче