<commit_before>var assert = require("../assert");

module.exports = {
  topic: function(d3) {
    return d3.select("body").append("div").transition()
        .delay(101)
        .duration(152)
        .ease("bounce");
  },

  "starts immediately after the previous transition ends": function(t1) {
    var t2 = t1.transition();
    assert.equal(t2[0][0].__transition__[t2.id].delay, 253);
  },
  "inherits the previous transition's duration": function(t1) {
    var t2 = t1.transition();
    assert.equal(t2[0][0].__transition__[t2.id].duration, 152);
  },
  "inherits easing": function(t1) {
    // TODO how to test this?
  },
  "gets a new transition id": function(t1) {
    var t2 = t1.transition();
    assert.isTrue(t2.id > t1.id);
  },

  "while transitioning": {
    topic: function(t1) {
      var callback = this.callback;
      var t2 = t1.transition().tween("custom", function() {
        return function(t) {
          if (callback) {
            callback(null, t2);
            callback = null;
          }
        };
      });
    },
    "increments the lock's reference count": function(t2) {
      assert.isTrue(t2[0][0].__transition__.count > 1);
    }
  },

  "after transitioning": {
    topic: function(t1) {
      var cb = this.callback;
      var t2 = t1.transition();
      t2.each("end", function() {
        setTimeout(function() {
          cb(null, t2);
          return true;
        }, 50);
      });
    },
    "decrements the lock's reference count": function(t2) {
      assert.isFalse("__transition__" in t2[0][0]);
    }
  }
};
<commit_msg>Fix transition test.<commit_after>var assert = require("../assert");

module.exports = {
  topic: function(d3) {
    return d3.select("body").append("div").transition()
        .delay(101)
        .duration(152)
        .ease("bounce");
  },

  "starts immediately after the previous transition ends": function(t1) {
    var t2 = t1.transition();
    assert.equal(t2[0][0].__transition__[t2.id].delay, 253);
  },
  "inherits the previous transition's duration": function(t1) {
    var t2 = t1.transition();
    assert.equal(t2[0][0].__transition__[t2.id].duration, 152);
  },
  "inherits easing": function(t1) {
    // TODO how to test this?
  },
  "gets a new transition id": function(t1) {
    var t2 = t1.transition();
    assert.isTrue(t2.id > t1.id);
  },

  "while transitioning": {
    topic: function(t1) {
      var callback = this.callback;
      var t2 = t1.transition().each("start", function() {
        if (callback) {
          callback(null, t2);
          callback = null;
        }
      });
    },
    "increments the lock's reference count": function(t2) {
      assert.isTrue(t2[0][0].__transition__.count > 1);
    }
  },

  "after transitioning": {
    topic: function(t1) {
      var cb = this.callback;
      var t2 = t1.transition();
      t2.each("end", function() {
        setTimeout(function() {
          cb(null, t2);
          return true;
        }, 50);
      });
    },
    "decrements the lock's reference count": function(t2) {
      assert.isFalse("__transition__" in t2[0][0]);
    }
  }
};

{'fraction_non_alphanumeric': 0.16553945249597424, 'fraction_numerical': 0.034782608695652174, 'mean_word_length': 2.458797327394209, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7382791', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1034, 'n_words': 216}