equal
deleted
inserted
replaced
|
1 require("../env"); |
|
2 require("../../d3"); |
|
3 |
|
4 var assert = require("assert"); |
|
5 |
|
6 module.exports = { |
|
7 topic: function() { |
|
8 return d3.select("body").append("div").transition() |
|
9 .delay(100) |
|
10 .duration(150) |
|
11 .ease("bounce"); |
|
12 }, |
|
13 |
|
14 "inherits the delay": function(t1) { |
|
15 var t2 = t1.transition(); |
|
16 assert.equal(t2[0][0].delay, 100); |
|
17 }, |
|
18 "inherits the duration": function(t1) { |
|
19 var t2 = t1.transition(); |
|
20 assert.equal(t2[0][0].duration, 150); |
|
21 }, |
|
22 "inherits easing": function(t1) { |
|
23 // TODO how to test this? |
|
24 }, |
|
25 "inherits the transition id": function(t1) { |
|
26 var t2 = t1.transition(); |
|
27 assert.equal(t2.id, t1.id); |
|
28 }, |
|
29 |
|
30 "while transitioning": { |
|
31 topic: function(t1) { |
|
32 var t2 = t1.transition(), |
|
33 cb = this.callback; |
|
34 t2.each("start", function() { |
|
35 d3.timer(function() { |
|
36 cb(null, t2); |
|
37 return true; |
|
38 }); |
|
39 }); |
|
40 }, |
|
41 "increments the lock's reference count": function(t2) { |
|
42 assert.isTrue(t2[0][0].node.__transition__.count > 1); |
|
43 } |
|
44 }, |
|
45 |
|
46 "after transitioning": { |
|
47 topic: function(t1) { |
|
48 var cb = this.callback; |
|
49 t1.each("end", function() { |
|
50 d3.timer(function() { |
|
51 cb(null, t1); |
|
52 return true; |
|
53 }, 50); |
|
54 }); |
|
55 }, |
|
56 "decrements the lock's reference count": function(t1) { |
|
57 assert.isFalse("__transition__" in t1[0][0].node); |
|
58 } |
|
59 } |
|
60 }; |