From 651902192310fbe548edc67bf8fad1f395af9212 Mon Sep 17 00:00:00 2001 From: archmoj Date: Sat, 16 Mar 2019 12:06:52 -0400 Subject: [PATCH 1/2] fix issue 3630 errorbars style after double click whitespace --- src/traces/bar/style.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/traces/bar/style.js b/src/traces/bar/style.js index be948a3877e..4bb672be6c9 100644 --- a/src/traces/bar/style.js +++ b/src/traces/bar/style.js @@ -71,6 +71,8 @@ function styleOnSelect(gd, cd) { stylePointsInSelectionMode(s, trace, gd); } else { stylePoints(s, trace, gd); + + Registry.getComponentMethod('errorbars', 'style')(s); } } From 5a5702fb42850b6eb9fbd3b7f0f41c3377fff1da Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 18 Mar 2019 10:15:31 -0400 Subject: [PATCH 2/2] adding a jasmine test to lock issue 3630 --- test/jasmine/tests/select_test.js | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test/jasmine/tests/select_test.js b/test/jasmine/tests/select_test.js index 5f788d6d80a..cae71ea0b90 100644 --- a/test/jasmine/tests/select_test.js +++ b/test/jasmine/tests/select_test.js @@ -688,6 +688,45 @@ describe('Click-to-select', function() { } }); + it('should maintain style of errorbars after double click cleared selection (bar case)', function(done) { + Plotly.newPlot(gd, { // Note: this call should be newPlot not plot + data: [{ + x: [0, 1, 2], + y: [100, 200, 400], + type: 'bar', + marker: { + color: 'yellow' + }, + error_y: { + type: 'sqrt' + } + }], + layout: { + dragmode: 'select' + } + }) + .then(function() { + var x = 100; + var y = 100; + drag([[x, y], [x, y]]); // first empty drag + return doubleClick(x, y); // then double click + }) + .then(function() { + assertSelectionCleared(); + }) + .then(function() { + d3.select(gd).select('g.plot').each(function() { + d3.select(this).selectAll('g.errorbar').selectAll('path').each(function() { + expect(d3.select(this).attr('style')) + .toBe('vector-effect: non-scaling-stroke; stroke-width: 2px; stroke: rgb(68, 68, 68); stroke-opacity: 1; opacity: 1; fill: rgb(255, 255, 0); fill-opacity: 1;', 'to be visible' + ); + }); + }); + }) + .catch(failTest) + .then(done); + }); + describe('triggers \'plotly_selected\' before \'plotly_click\'', function() { [ testCase('cartesian', require('@mocks/14.json'), 270, 160, [7]),