Sha256: 34448b17f86a668bbee3eecda18a5cfe539da986cefb00c85ff8b26bf1dd3bf5

Contents?: true

Size: 1.48 KB

Versions: 25

Compression:

Stored size: 1.48 KB

Contents

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

var assert = require("assert");

module.exports = {
  topic: function() {
    return d3.select("body").html("").selectAll()
        .data(["foo", "bar"])
      .enter().append("div")
        .attr("class", String);
  },
  "defaults to zero": function(selection) {
    var t = selection.transition();
    assert.strictEqual(t[0][0].delay, 0);
    assert.strictEqual(t[0][1].delay, 0);
  },
  "can specify delay as a number": function(selection) {
    var t = selection.transition().delay(150);
    assert.strictEqual(t[0][0].delay, 150);
    assert.strictEqual(t[0][1].delay, 150);
    t.delay(250);
    assert.strictEqual(t[0][0].delay, 250);
    assert.strictEqual(t[0][1].delay, 250);
  },
  "can specify delay as a function": function(selection) {
    var dd = [], ii = [], tt = [], t = selection.transition().delay(f);
    function f(d, i) { dd.push(d); ii.push(i); tt.push(this); return i * 20; }
    assert.strictEqual(t[0][0].delay, 0);
    assert.strictEqual(t[0][1].delay, 20);
    assert.deepEqual(dd, ["foo", "bar"], "expected data, got {actual}");
    assert.deepEqual(ii, [0, 1], "expected index, got {actual}");
    assert.domEqual(tt[0], t[0][0].node, "expected this, got {actual}");
    assert.domEqual(tt[1], t[0][1].node, "expected this, got {actual}");
  },
  "coerces delay to a number": function(selection) {
    var t = selection.transition().delay("150");
    assert.strictEqual(t[0][0].delay, 150);
    assert.strictEqual(t[0][1].delay, 150);
  }
};

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js