Skip to content

Commit 57085e1

Browse files
committed
shorten parcoords snap tweening during tests
1 parent 352a884 commit 57085e1

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

test/jasmine/tests/parcoords_test.js

+24-11
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,20 @@ describe('@gl parcoords constraint interactions', function() {
10851085
};
10861086
}
10871087

1088-
afterAll(purgeGraphDiv);
1088+
var parcoordsConstants = require('@src/traces/parcoords/constants');
1089+
var initialSnapDuration;
1090+
var shortenedSnapDuration = 20;
1091+
var snapDelay = 100;
1092+
var noSnapDelay = 20;
1093+
beforeAll(function() {
1094+
initialSnapDuration = parcoordsConstants.bar.snapDuration;
1095+
parcoordsConstants.bar.snapDuration = shortenedSnapDuration;
1096+
});
1097+
1098+
afterAll(function() {
1099+
purgeGraphDiv();
1100+
parcoordsConstants.bar.snapDuration = initialSnapDuration;
1101+
});
10891102

10901103
beforeEach(function(done) {
10911104
var hasGD = !!gd;
@@ -1139,7 +1152,7 @@ describe('@gl parcoords constraint interactions', function() {
11391152
checkDashCount(newDashArray, 1);
11401153

11411154
mouseEvent('mouseup', 105, 190);
1142-
delay(300)().then(function() {
1155+
delay(snapDelay)().then(function() {
11431156
expect(getDashArray(0)).toBe(initialDashArray0);
11441157
expect(gd.data[0].dimensions[0].constraintrange).toBeCloseToArray([2.75, 4]);
11451158

@@ -1150,7 +1163,7 @@ describe('@gl parcoords constraint interactions', function() {
11501163

11511164
mouseEvent('mouseup', 105, 240);
11521165
})
1153-
.then(delay(300))
1166+
.then(delay(snapDelay))
11541167
.then(function() {
11551168
expect(getDashArray(0)).toBe(initialDashArray0);
11561169
expect(gd.data[0].dimensions[0].constraintrange).toBeCloseToArray([2.75, 4]);
@@ -1162,7 +1175,7 @@ describe('@gl parcoords constraint interactions', function() {
11621175

11631176
mouseEvent('mouseup', 105, 260);
11641177
})
1165-
.then(delay(300))
1178+
.then(delay(snapDelay))
11661179
.then(function() {
11671180
newDashArray = getDashArray(0);
11681181
checkDashCount(newDashArray, 2);
@@ -1175,7 +1188,7 @@ describe('@gl parcoords constraint interactions', function() {
11751188

11761189
mouseEvent('mouseup', 105, 240);
11771190
})
1178-
.then(delay(300))
1191+
.then(delay(snapDelay))
11791192
.then(function() {
11801193
newDashArray = getDashArray(0);
11811194
checkDashCount(newDashArray, 2);
@@ -1184,7 +1197,7 @@ describe('@gl parcoords constraint interactions', function() {
11841197
// clear the whole thing
11851198
click(105, 290);
11861199
})
1187-
.then(delay(300))
1200+
.then(delay(snapDelay))
11881201
.then(function() {
11891202
checkDashCount(getDashArray(0), 0);
11901203
expect(gd.data[0].dimensions[0].constraintrange).toBeUndefined();
@@ -1201,7 +1214,7 @@ describe('@gl parcoords constraint interactions', function() {
12011214
checkDashCount(newDashArray, 1);
12021215

12031216
mouseEvent('mouseup', 295, 190);
1204-
delay(100)().then(function() {
1217+
delay(noSnapDelay)().then(function() {
12051218
expect(getDashArray(1)).toBe(newDashArray);
12061219
expect(gd.data[0].dimensions[1].constraintrange).toBeCloseToArray([4.8959, 9]);
12071220

@@ -1212,7 +1225,7 @@ describe('@gl parcoords constraint interactions', function() {
12121225

12131226
mouseEvent('mouseup', 295, 240);
12141227
})
1215-
.then(delay(100))
1228+
.then(delay(noSnapDelay))
12161229
.then(function() {
12171230
expect(getDashArray(1)).toBe(newDashArray);
12181231
expect(gd.data[0].dimensions[1].constraintrange).toBeCloseTo2DArray([[0.7309, 2.8134], [4.8959, 9]]);
@@ -1225,7 +1238,7 @@ describe('@gl parcoords constraint interactions', function() {
12251238

12261239
mouseEvent('mouseup', 295, 260);
12271240
})
1228-
.then(delay(100))
1241+
.then(delay(noSnapDelay))
12291242
.then(function() {
12301243
expect(getDashArray(1)).toBe(newDashArray);
12311244
// TODO: ideally this would get clipped to [0, 9]...
@@ -1249,7 +1262,7 @@ describe('@gl parcoords constraint interactions', function() {
12491262

12501263
mouseEvent('mouseup', 295, 240);
12511264
})
1252-
.then(delay(100))
1265+
.then(delay(noSnapDelay))
12531266
.then(function() {
12541267
expect(getDashArray(1)).toBe(newDashArray);
12551268
expect(gd.data[0].dimensions[1].constraintrange).toBeCloseToArray([0.7309, 2.8134]);
@@ -1261,7 +1274,7 @@ describe('@gl parcoords constraint interactions', function() {
12611274

12621275
mouseEvent('mouseup', 105, 260);
12631276
})
1264-
.then(delay(300))
1277+
.then(delay(snapDelay))
12651278
.then(function() {
12661279
var finalDashArray = getDashArray(0);
12671280
expect(finalDashArray).not.toBe(newDashArray);

0 commit comments

Comments
 (0)