This commit is contained in:
Mike Bostock 2014-10-09 12:16:04 -07:00
Родитель 9b953bde43
Коммит f38ed05731
3 изменённых файлов: 8 добавлений и 8 удалений

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

@ -90,8 +90,8 @@ suite.addBatch({
},
"sets a property as a function": function(div) {
div.style("background-color", _.interpolateRgb("orange", "yellow"));
assert.equal(div[0][0].style.getPropertyValue("background-color"), "#ffa500");
assert.equal(div[0][1].style.getPropertyValue("background-color"), "#ffff00");
assert.equal(div[0][0].style.getPropertyValue("background-color"), "rgb(255, 165, 0)");
assert.equal(div[0][1].style.getPropertyValue("background-color"), "rgb(255, 255, 0)");
},
"gets a property value": function(div) {
div[0][0].style.setProperty("background-color", "green", "");

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

@ -28,13 +28,13 @@ module.exports = {
result.transition.each("end", function() { cb(null, result); });
},
"the last style operator takes precedence": function(result) {
assert.equal(result.selection.style("background-color"), "#ff0000");
assert.equal(result.selection.style("background-color"), "rgb(255, 0, 0)");
},
"sets a property as a string": function(result) {
assert.equal(result.selection.style("background-color"), "#ff0000");
assert.equal(result.selection.style("background-color"), "rgb(255, 0, 0)");
},
"sets a property as a function": function(result) {
assert.equal(result.selection.style("color"), "#008000");
assert.equal(result.selection.style("color"), "rgb(0, 128, 0)");
},
"observes the specified priority": function(result) {
var style = result.selection.node().style;

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

@ -45,7 +45,7 @@ module.exports = {
"invokes the tween function": function(result) {
assert.deepEqual(result.data, ["red", "green"], "expected data, got {actual}");
assert.deepEqual(result.index, [0, 1], "expected index, got {actual}");
assert.deepEqual(result.value, ["#ff0000", "#008000"], "expected value, got {actual}");
assert.deepEqual(result.value, ["rgb(255, 0, 0)", "rgb(0, 128, 0)"], "expected value, got {actual}");
assert.domEqual(result.context[0], result.selection[0][0], "expected this, got {actual}");
assert.domEqual(result.context[1], result.selection[0][1], "expected this, got {actual}");
},
@ -56,10 +56,10 @@ module.exports = {
result.transition.each("end", function(d, i) { if (i >= 1) cb(null, result); });
},
"uses the returned interpolator": function(result) {
assert.equal(result.selection[0][1].style.getPropertyValue("background-color"), "#0000ff");
assert.equal(result.selection[0][1].style.getPropertyValue("background-color"), "rgb(0, 0, 255)");
},
"does nothing if the interpolator is falsey": function(result) {
assert.equal(result.selection[0][0].style.getPropertyValue("background-color"), "#ff0000");
assert.equal(result.selection[0][0].style.getPropertyValue("background-color"), "rgb(255, 0, 0)");
}
}
};