Skip to content

Commit bc2ca4d

Browse files
committed
update test cases
1 parent af63f9d commit bc2ca4d

File tree

1 file changed

+37
-34
lines changed

1 file changed

+37
-34
lines changed

tests/index.js

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,18 @@ describe('rc-queue-anim', () => {
9898
});
9999

100100
it('should render children', () => {
101-
const instance = createQueueAnimInstance();
101+
const instance = createQueueAnimInstance({
102+
ease: 'easeInBounce',
103+
});
102104
const children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
103105
expect(children.length).to.be(4);
104106
});
105107

106108
it('should have queue animation', (done) => {
107109
const interval = defaultInterval;
108-
const instance = createQueueAnimInstance();
110+
const instance = createQueueAnimInstance({
111+
ease: 'easeInOutBounce',
112+
});
109113
shouldAnimatingThisOne(instance, 0);
110114
setTimeout(() => {
111115
shouldAnimatingThisOne(instance, 1);
@@ -121,7 +125,10 @@ describe('rc-queue-anim', () => {
121125

122126
it('should have interval', (done) => {
123127
const interval = 300;
124-
const instance = createQueueAnimInstance({ interval });
128+
const instance = createQueueAnimInstance({
129+
interval,
130+
ease: 'easeOutBounce',
131+
});
125132
shouldAnimatingThisOne(instance, 0);
126133
setTimeout(() => {
127134
shouldAnimatingThisOne(instance, 1);
@@ -193,15 +200,13 @@ describe('rc-queue-anim', () => {
193200
left: [100, 0],
194201
},
195202
});
203+
let children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
204+
expect(isNaN(getLeft(children[1]))).to.be.ok();
196205
setTimeout(() => {
197-
let children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
198-
expect(isNaN(getLeft(children[1]))).to.be.ok();
199-
setTimeout(() => {
200-
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
201-
expect(getLeft(children[1])).to.above(0);
202-
done();
203-
}, 10);
204-
}, 0);
206+
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
207+
expect(getLeft(children[1])).to.above(0);
208+
done();
209+
}, 10);
205210
});
206211

207212
it('should support animation when change direction at animating', (done) => {
@@ -262,36 +267,34 @@ describe('rc-queue-anim', () => {
262267
return { left: [100, 0] };
263268
},
264269
});
270+
let children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
271+
expect(isNaN(getLeft(children[1]))).to.be.ok();
272+
expect(isNaN(getTop(children[2]))).to.be.ok();
265273
setTimeout(() => {
266-
let children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
267-
expect(isNaN(getLeft(children[1]))).to.be.ok();
268-
expect(isNaN(getTop(children[2]))).to.be.ok();
274+
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
275+
expect(getLeft(children[1])).to.above(0);
276+
expect(isNaN(getTop(children[1]))).to.be.ok();
277+
console.log('left:', getLeft(children[1]));
269278
setTimeout(() => {
270279
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
271-
expect(getLeft(children[1])).to.above(0);
272-
expect(isNaN(getTop(children[1]))).to.be.ok();
273-
console.log('left:', getLeft(children[1]));
280+
expect(getTop(children[2])).to.above(0);
281+
expect(isNaN(getLeft(children[2]))).to.be.ok();
282+
console.log('top:', getTop(children[2]));
274283
setTimeout(() => {
275284
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
276-
expect(getTop(children[2])).to.above(0);
285+
expect(getTop(children[2])).to.be(100);
277286
expect(isNaN(getLeft(children[2]))).to.be.ok();
278-
console.log('top:', getTop(children[2]));
279-
setTimeout(() => {
280-
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
281-
expect(getTop(children[2])).to.be(100);
282-
expect(isNaN(getLeft(children[2]))).to.be.ok();
283-
console.log('top_end:', getTop(children[2]));
284-
done();
285-
}, 500);
286-
}, interval);
287-
setTimeout(() => {
288-
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
289-
expect(getLeft(children[1])).to.be(100);
290-
expect(isNaN(getTop(children[1]))).to.be.ok();
291-
console.log('left_end:', getLeft(children[1]));
287+
console.log('top_end:', getTop(children[2]));
288+
done();
292289
}, 500);
293-
}, 10);
294-
}, 0);
290+
}, interval);
291+
setTimeout(() => {
292+
children = TestUtils.scryRenderedDOMComponentsWithTag(instance, 'div');
293+
expect(getLeft(children[1])).to.be(100);
294+
expect(isNaN(getTop(children[1]))).to.be.ok();
295+
console.log('left_end:', getLeft(children[1]));
296+
}, 500);
297+
}, 10);
295298
});
296299

297300
it('should has animating config is func leave', (done) => {

0 commit comments

Comments
 (0)