Sha256: 5524efd18c80a898e71bedbe48a6b3f25bd41937adf495395467d94d2496ddf7

Contents?: true

Size: 963 Bytes

Versions: 4

Compression:

Stored size: 963 Bytes

Contents

var assert = require("../assert");

module.exports = {
  topic: function(d3) {
    return d3.select("body").append("div").transition();
  },
  "calls the function once": function(transition) {
    var count = 0;
    transition.call(function() { ++count; });
    assert.equal(count, 1);
  },
  "passes any optional arguments": function(transition) {
    var abc;
    transition.call(function(selection, a, b, c) { abc = [a, b, c]; }, "a", "b", "c");
    assert.deepEqual(abc, ["a", "b", "c"]);
  },
  "passes the transition as the first argument": function(transition) {
    var t;
    transition.call(function(x) { t = x; });
    assert.isTrue(t === transition);
  },
  "uses the transition as the context": function(transition) {
    var t;
    transition.call(function() { t = this; });
    assert.isTrue(t === transition);
  },
  "returns the current transition": function(transition) {
    assert.isTrue(transition.call(function() {}) === transition);
  }
};

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
stripchart-0.0.3 lib/stripchart/public/components/d3/test/transition/transition-test-call.js
stripmem-0.0.3 lib/stripmem/public/components/d3/test/transition/transition-test-call.js
stripmem-0.0.2 lib/stripmem/public/components/d3/test/transition/transition-test-call.js
stripmem-0.0.1 lib/stripmem/public/components/d3/test/transition/transition-test-call.js