@@ -42,7 +42,9 @@ function print(obj) {
4242 return obj ;
4343}
4444
45- function assertPos ( actual , expected ) {
45+ function assertPos ( actual , expected , tolerance ) {
46+ if ( tolerance === undefined ) tolerance = 2 ;
47+
4648 expect ( typeof actual ) . toEqual ( typeof expected ) ;
4749
4850 if ( typeof actual === 'string' ) {
@@ -61,7 +63,7 @@ function assertPos(actual, expected) {
6163 expect ( A . length ) . toEqual ( B . length ) ; // svg letters should be identical
6264 expect ( A [ 0 ] ) . toEqual ( B [ 0 ] ) ;
6365 for ( var k = 1 ; k < A . length ; k ++ ) {
64- expect ( A [ k ] ) . toBeCloseTo ( B [ k ] , 2 ) ;
66+ expect ( A [ k ] ) . toBeCloseTo ( B [ k ] , tolerance ) ;
6567 }
6668 }
6769 } else {
@@ -79,7 +81,7 @@ function assertPos(actual, expected) {
7981 posB = fixDates ( posB ) ;
8082 }
8183
82- expect ( posA ) . toBeCloseTo ( posB , 2 ) ;
84+ expect ( posA ) . toBeCloseTo ( posB , tolerance ) ;
8385 }
8486 }
8587}
@@ -1063,7 +1065,7 @@ describe('Activate and deactivate shapes to edit', function() {
10631065 afterEach ( destroyGraphDiv ) ;
10641066
10651067 [ 'mouse' ] . forEach ( function ( device ) {
1066- it ( '@flaky activate editable shapes using' + device , function ( done ) {
1068+ it ( '@flaky activate and edit editable shapes using' + device , function ( done ) {
10671069 var i ;
10681070
10691071 Plotly . newPlot ( gd , {
@@ -1096,7 +1098,7 @@ describe('Activate and deactivate shapes to edit', function() {
10961098 'y1' : 75
10971099 } ) ;
10981100 } )
1099- . then ( function ( ) { drag ( [ [ 175 , 160 ] , [ 150 , 100 ] ] ) ; } ) // move vertex
1101+ . then ( function ( ) { drag ( [ [ 255 , 230 ] , [ 300 , 200 ] ] ) ; } ) // move vertex
11001102 . then ( function ( ) {
11011103 var id = gd . _fullLayout . _activeShapeIndex ;
11021104 expect ( id ) . toEqual ( i , 'keep shape active after drag corner' ) ;
@@ -1111,13 +1113,13 @@ describe('Activate and deactivate shapes to edit', function() {
11111113 'x1' : obj . x1 ,
11121114 'y1' : obj . y1
11131115 } , {
1114- 'x0' : 9.494573643410854 ,
1115- 'y0' : - 17.732937685459945 ,
1116- 'x1' : 75.0015503875969 ,
1117- 'y1' : 74.99821958456974
1116+ 'x0' : 24.998449612403103 ,
1117+ 'y0' : 24.997032640949552 ,
1118+ 'x1' : 102.90852713178295 ,
1119+ 'y1' : 53.63323442136499
11181120 } ) ;
11191121 } )
1120- . then ( function ( ) { drag ( [ [ 150 , 100 ] , [ 175 , 160 ] ] ) ; } ) // move vertex back
1122+ . then ( function ( ) { drag ( [ [ 300 , 200 ] , [ 255 , 230 ] ] ) ; } ) // move vertex back
11211123 . then ( function ( ) {
11221124 var id = gd . _fullLayout . _activeShapeIndex ;
11231125 expect ( id ) . toEqual ( i , 'keep shape active after drag corner' ) ;
@@ -1138,7 +1140,7 @@ describe('Activate and deactivate shapes to edit', function() {
11381140 'y1' : 75
11391141 } ) ;
11401142 } )
1141- . then ( function ( ) { drag ( [ [ 215 , 195 ] , [ 150 , 100 ] ] ) ; } ) // move shape
1143+ . then ( function ( ) { drag ( [ [ 215 , 195 ] , [ 300 , 200 ] ] ) ; } ) // move shape
11421144 . then ( function ( ) {
11431145 var id = gd . _fullLayout . _activeShapeIndex ;
11441146 expect ( id ) . toEqual ( i , 'keep shape active after drag corner' ) ;
@@ -1153,13 +1155,13 @@ describe('Activate and deactivate shapes to edit', function() {
11531155 'x1' : obj . x1 ,
11541156 'y1' : obj . y1
11551157 } , {
1156- 'y0 ' : - 42.65875370919882 ,
1157- 'y1 ' : 7.342433234421367 ,
1158- 'x0 ' : - 15.311627906976742 ,
1159- 'x1 ' : 34.691472868217055
1158+ 'x0 ' : 77.71162790697674 ,
1159+ 'y0 ' : 24.997032640949552 ,
1160+ 'x1 ' : 127.71472868217053 ,
1161+ 'y1 ' : 74.99821958456974
11601162 } ) ;
11611163 } )
1162- . then ( function ( ) { drag ( [ [ 150 , 100 ] , [ 215 , 195 ] ] ) ; } ) // move shape back
1164+ . then ( function ( ) { drag ( [ [ 300 , 200 ] , [ 215 , 195 ] ] ) ; } ) // move shape back
11631165 . then ( function ( ) {
11641166 var id = gd . _fullLayout . _activeShapeIndex ;
11651167 expect ( id ) . toEqual ( i , 'keep shape active after drag corner' ) ;
0 commit comments