|
1 |
| -casper.test.begin('CSS Transition', 20, function (test) { |
| 1 | +casper.test.begin('CSS Transition', 37, function (test) { |
2 | 2 |
|
3 | 3 | var minWait = 50,
|
4 | 4 | transDuration = 200
|
@@ -42,20 +42,51 @@ casper.test.begin('CSS Transition', 20, function (test) {
|
42 | 42 | .wait(transDuration, function () {
|
43 | 43 | test.assertNotVisible('.test.if')
|
44 | 44 | test.assertNotVisible('.test[data-id="1"]')
|
45 |
| - test.assertNotVisible('.test[data-id="2"]') |
46 | 45 | })
|
47 | 46 | .thenClick('.splice')
|
48 | 47 | .wait(minWait, function () {
|
49 | 48 | test.assertVisible('.test[data-id="99"]')
|
50 | 49 | })
|
51 | 50 | // test Array swapping with transition
|
52 | 51 | .thenEvaluate(function () {
|
53 |
| - test.items = [test.items[0], {a:3}] |
| 52 | + test.items = [{a:1}, {a:2}, {a:3}, {a:4}, {a:5}] |
54 | 53 | })
|
55 | 54 | .wait(minWait, function () {
|
56 | 55 | test.assertVisible('.test.if')
|
57 |
| - test.assertVisible('.test[data-id="99"]') |
| 56 | + test.assertElementCount('.test', 7) |
| 57 | + test.assertElementCount('.test[data-id="99"].v-leave', 1) |
| 58 | + test.assertNotVisible('.test[data-id="1"]') |
| 59 | + test.assertNotVisible('.test[data-id="2"]') |
58 | 60 | test.assertVisible('.test[data-id="3"]')
|
| 61 | + test.assertVisible('.test[data-id="4"]') |
| 62 | + test.assertVisible('.test[data-id="5"]') |
| 63 | + }) |
| 64 | + .wait(transDuration, function () { |
| 65 | + // old one should be removed now |
| 66 | + test.assertElementCount('.test', 6) |
| 67 | + test.assertElementCount('.test.v-leave', 0) |
| 68 | + test.assertElementCount('.test[data-id="99"]', 0) |
| 69 | + }) |
| 70 | + // test Array diffing with transition |
| 71 | + .thenEvaluate(function () { |
| 72 | + test.items = [test.items[4], {a:6}, test.items[2], {a:7}, test.items[0]] |
| 73 | + }) |
| 74 | + .wait(minWait, function () { |
| 75 | + // reusing 3 existing, one of the destroyed (a=2) is hidden, so only 1 item should be leaving |
| 76 | + test.assertElementCount('.test.v-leave', 1) |
| 77 | + // only 2 new items should be in the DOM, the hidden element is removed immediately |
| 78 | + // so should have 5 + 1 + 1 = 7 items |
| 79 | + test.assertElementCount('.test', 7) |
| 80 | + }) |
| 81 | + .wait(transDuration, function () { |
| 82 | + test.assertElementCount('.test.v-leave', 0) |
| 83 | + test.assertElementCount('.test', 6) |
| 84 | + test.assertSelectorHasText('li.test:nth-child(1)', '5') |
| 85 | + test.assertSelectorHasText('li.test:nth-child(2)', '6') |
| 86 | + test.assertSelectorHasText('li.test:nth-child(3)', '3') |
| 87 | + test.assertSelectorHasText('li.test:nth-child(4)', '7') |
| 88 | + test.assertSelectorHasText('li.test:nth-child(5)', '1') |
| 89 | + test.assertNotVisible('li.test:nth-child(5)') |
59 | 90 | })
|
60 | 91 | .run(function () {
|
61 | 92 | test.done()
|
|
0 commit comments