Sha256: 49047bef69eafd30e016706ddb6c24eaded4754abc72122631cc75655a0776f7

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

require("../env");
require("../../d3");

var assert = require("assert");

module.exports = {
  topic: function() {
    var cb = this.callback;

    var s = d3.select("body").append("div")
        .attr("width", 20)
        .attr("color", "red");

    var t = s.transition()
        .attr("width", 100)
        .attr("width", 200)
        .attr("color", function() { return "green"; })
        .each("end", function() { cb(null, {selection: s, transition: t}); });
  },
  "defines the corresponding attr tween": function(result) {
    assert.typeOf(result.transition.tween("attr.width"), "function");
    assert.typeOf(result.transition.tween("attr.color"), "function");
  },
  "the last attr operator takes precedence": function(result) {
    assert.equal(result.selection.attr("width"), "200");
  },
  "sets an attribute as a number": function(result) {
    assert.equal(result.selection.attr("width"), "200");
  },
  "sets an attribute as a function": function(result) {
    assert.equal(result.selection.attr("color"), "rgb(0,128,0)");
  }
};

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bum-0.0.17 public/d3/test/core/transition-test-attr.js
bum-0.0.16 public/d3/test/core/transition-test-attr.js
bum-0.0.15 public/d3/test/core/transition-test-attr.js
bum-0.0.14 public/d3/test/core/transition-test-attr.js
bum-0.0.13 public/d3/test/core/transition-test-attr.js
bum-0.0.12 public/d3/test/core/transition-test-attr.js