@@ -5,6 +5,7 @@ var Colorbar = require('@src/components/colorbar');
5
5
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
6
6
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
7
7
var failTest = require ( '../assets/fail_test' ) ;
8
+ var assertPlotSize = require ( '../assets/custom_assertions' ) . assertPlotSize ;
8
9
9
10
10
11
describe ( 'Test colorbar:' , function ( ) {
@@ -127,11 +128,7 @@ describe('Test colorbar:', function() {
127
128
var colorbars = d3 . select ( gd ) . selectAll ( '.colorbar' ) ;
128
129
expect ( colorbars . size ( ) ) . toBe ( present ? 1 : 0 ) ;
129
130
130
- var yLines = d3 . select ( gd ) . selectAll ( '.ygrid' ) ;
131
- expect ( yLines . size ( ) ) . toBeGreaterThan ( 0 ) ;
132
- var yLineWidth = + yLines . node ( ) . getBoundingClientRect ( ) . width ;
133
- if ( expandedMargin ) expect ( yLineWidth ) . toBeLessThan ( 400 ) ;
134
- else expect ( yLineWidth ) . toBe ( 400 ) ;
131
+ assertPlotSize ( expandedMargin ? { widthLessThan : 400 } : { width : 400 } ) ;
135
132
}
136
133
137
134
Plotly . newPlot ( gd , [ {
@@ -170,11 +167,7 @@ describe('Test colorbar:', function() {
170
167
var colorbars = d3 . select ( gd ) . selectAll ( '.colorbar' ) ;
171
168
expect ( colorbars . size ( ) ) . toBe ( present ? 1 : 0 ) ;
172
169
173
- var yLines = d3 . select ( gd ) . selectAll ( '.ygrid' ) ;
174
- expect ( yLines . size ( ) ) . toBeGreaterThan ( 0 ) ;
175
- var yLineWidth = + yLines . node ( ) . getBoundingClientRect ( ) . width ;
176
- if ( expandedMargin ) expect ( yLineWidth ) . toBeLessThan ( 400 ) ;
177
- else expect ( yLineWidth ) . toBe ( 400 ) ;
170
+ assertPlotSize ( expandedMargin ? { widthLessThan : 400 } : { width : 400 } ) ;
178
171
}
179
172
180
173
Plotly . newPlot ( gd , [ {
0 commit comments