Skip to content

Commit 2da3544

Browse files
committed
cleaner delay pattern in pan tester
1 parent 00c7ad5 commit 2da3544

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/jasmine/tests/cartesian_interact_test.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ describe('main plot pan', function() {
109109
expect(gd.layout.xaxis.range).toBeCloseToArray(originalX, precision);
110110
expect(gd.layout.yaxis.range).toBeCloseToArray(originalY, precision);
111111

112-
setTimeout(function() {
112+
delay(MODEBAR_DELAY)()
113+
.then(function() {
113114

114115
expect(relayoutCallback).toHaveBeenCalledTimes(1);
115116
relayoutCallback.calls.reset();
@@ -167,16 +168,14 @@ describe('main plot pan', function() {
167168

168169
expect(gd.layout.xaxis.range).toBeCloseToArray(originalX, precision);
169170
expect(gd.layout.yaxis.range).toBeCloseToArray(originalY, precision);
170-
171-
setTimeout(function() {
172-
173-
expect(relayoutCallback).toHaveBeenCalledTimes(6); // X and back; Y and back; XY and back
174-
175-
done();
176-
177-
}, MODEBAR_DELAY);
178-
179-
}, MODEBAR_DELAY);
171+
})
172+
.then(delay(MODEBAR_DELAY))
173+
.then(function() {
174+
// X and back; Y and back; XY and back
175+
expect(relayoutCallback).toHaveBeenCalledTimes(6);
176+
})
177+
.catch(failTest)
178+
.then(done);
180179
});
181180
});
182181

0 commit comments

Comments
 (0)