From 93dc7431193b3191bf6e1cd78ff081d1e4fe410c Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Wed, 12 Apr 2017 17:08:15 -0400 Subject: [PATCH 1/2] make annotation test more robust? --- test/jasmine/tests/annotations_test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/jasmine/tests/annotations_test.js b/test/jasmine/tests/annotations_test.js index 3a1711daabb..bac6d341ec6 100644 --- a/test/jasmine/tests/annotations_test.js +++ b/test/jasmine/tests/annotations_test.js @@ -1095,8 +1095,8 @@ describe('annotation effects', function() { mouseEvent('mouseout', pos[0], pos[1]); mouseEvent('mousemove', 0, 0); - setTimeout(resolve, constants.HOVERMINTIME); - }, constants.HOVERMINTIME); + setTimeout(resolve, constants.HOVERMINTIME * 1.5); + }, constants.HOVERMINTIME * 1.5); }); } @@ -1107,10 +1107,10 @@ describe('annotation effects', function() { spec.push([pos0Head, '']); spec.push([pos2Head, '']); var p = Promise.resolve(); - spec.forEach(function(speci, i) { + spec.forEach(function(speci) { p = p.then(function() { return assertHoverLabel(speci[0], speci[1], - msg ? msg + ' (' + i + ')' : i); + msg ? msg + ' (' + speci + ')' : speci); }); }); return p; @@ -1132,7 +1132,7 @@ describe('annotation effects', function() { } makePlot([ - {x: 50, y: 50, text: 'hi', width: 50, ax: 0, ay: -40, xshift: -50, yshift: 50}, + {x: 50, y: 50, text: 'hi', width: 50, height: 40, ax: 0, ay: -40, xshift: -50, yshift: 50}, {x: 20, y: 20, text: 'bye', height: 40, showarrow: false}, {x: 80, y: 80, text: 'why?', ax: 0, ay: -40} ], {}) // turn off the default editable: true From 4a9b34411c3ece7c52396f969614a6f40fe27457 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Wed, 12 Apr 2017 18:35:59 -0400 Subject: [PATCH 2/2] more delays in annotation test most importantly between clicks to avoid autorange --- test/jasmine/tests/annotations_test.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/jasmine/tests/annotations_test.js b/test/jasmine/tests/annotations_test.js index bac6d341ec6..b6811cade12 100644 --- a/test/jasmine/tests/annotations_test.js +++ b/test/jasmine/tests/annotations_test.js @@ -5,7 +5,8 @@ var Plots = require('@src/plots/plots'); var Lib = require('@src/lib'); var Loggers = require('@src/lib/loggers'); var Axes = require('@src/plots/cartesian/axes'); -var constants = require('@src/plots/cartesian/constants'); +var HOVERMINTIME = require('@src/plots/cartesian/constants').HOVERMINTIME; +var DBLCLICKDELAY = require('@src/constants/interactions').DBLCLICKDELAY; var d3 = require('d3'); var customMatchers = require('../assets/custom_matchers'); @@ -1095,8 +1096,8 @@ describe('annotation effects', function() { mouseEvent('mouseout', pos[0], pos[1]); mouseEvent('mousemove', 0, 0); - setTimeout(resolve, constants.HOVERMINTIME * 1.5); - }, constants.HOVERMINTIME * 1.5); + setTimeout(resolve, HOVERMINTIME * 1.1); + }, HOVERMINTIME * 1.1); }); } @@ -1106,7 +1107,9 @@ describe('annotation effects', function() { // so we only have to explicitly include pos0-2 spec.push([pos0Head, '']); spec.push([pos2Head, '']); - var p = Promise.resolve(); + var p = new Promise(function(resolve) { + setTimeout(resolve, HOVERMINTIME); + }); spec.forEach(function(speci) { p = p.then(function() { return assertHoverLabel(speci[0], speci[1], @@ -1122,7 +1125,7 @@ describe('annotation effects', function() { setTimeout(function() { resolve(); - }, constants.HOVERMINTIME); + }, DBLCLICKDELAY * 1.1); }); }