Skip to content

Commit cda735b

Browse files
committed
make hoverlabel text selection query more robust
- so that it doesn't catch the <text>trace name</text> node by accident if present.
1 parent 28c2770 commit cda735b

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

test/jasmine/tests/gl_plot_interact_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Test gl3d plots', function() {
6565
expect(path.style('fill')).toEqual(bgColor, 'bgcolor');
6666
expect(path.style('stroke')).toEqual(borderColor, 'bordercolor');
6767

68-
var text = node.select('text');
68+
var text = node.select('text.nums');
6969
expect(parseInt(text.style('font-size'))).toEqual(fontSize, 'font.size');
7070
expect(text.style('font-family').split(',')[0]).toEqual(fontFamily, 'font.family');
7171
expect(text.style('fill')).toEqual(fontColor, 'font.color');

test/jasmine/tests/hover_label_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ describe('Test hover label custom styling:', function() {
995995
expect(path.style('fill')).toEqual(expectation.path[0], 'bgcolor');
996996
expect(path.style('stroke')).toEqual(expectation.path[1], 'bordercolor');
997997

998-
var text = g.select('text');
998+
var text = g.select({hovertext: 'text.nums', axistext: 'text'}[className]);
999999
expect(parseInt(text.style('font-size'))).toEqual(expectation.text[0], 'font.size');
10001000
expect(text.style('font-family').split(',')[0]).toEqual(expectation.text[1], 'font.family');
10011001
expect(text.style('fill')).toEqual(expectation.text[2], 'font.color');

test/jasmine/tests/hover_pie_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ describe('pie hovering', function() {
205205
expect(path.style('fill')).toEqual(style[0], 'bgcolor');
206206
expect(path.style('stroke')).toEqual(style[1], 'bordercolor');
207207

208-
var text = g.select('text');
208+
var text = g.select('text.nums');
209209
expect(parseInt(text.style('font-size'))).toEqual(style[2], 'font.size');
210210
expect(text.style('font-family').split(',')[0]).toEqual(style[3], 'font.family');
211211
expect(text.style('fill')).toEqual(style[4], 'font.color');

test/jasmine/tests/mapbox_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ describe('@noCI, mapbox plots', function() {
720720
})
721721
.then(function() {
722722
var path = d3.select('g.hovertext').select('path');
723-
var text = d3.select('g.hovertext').select('text');
723+
var text = d3.select('g.hovertext').select('text.nums');
724724

725725
expect(path.style('fill')).toEqual('rgb(255, 255, 0)', 'bgcolor');
726726
expect(text.style('font-size')).toEqual('20px', 'font.size[0]');

test/jasmine/tests/ternary_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('ternary plots', function() {
131131
mouseEvent('mousemove', pointPos[0], pointPos[1]);
132132

133133
var path = d3.select('g.hovertext').select('path');
134-
var text = d3.select('g.hovertext').select('text');
134+
var text = d3.select('g.hovertext').select('text.nums');
135135

136136
expect(path.style('stroke')).toEqual('rgb(0, 0, 255)', 'bordercolor');
137137
expect(text.style('font-family')).toEqual('Gravitas', 'font.family[0]');

0 commit comments

Comments
 (0)