@@ -186,18 +186,46 @@ describe('ternary plots', function() {
186
186
it ( 'should respond zoom drag interactions' , function ( done ) {
187
187
assertRange ( gd , [ 0.231 , 0.2 , 0.11 ] ) ;
188
188
189
- Plotly . relayout ( gd , 'ternary.aaxis.min' , 0.1 ) . then ( function ( ) {
190
- assertRange ( gd , [ 0.1 , 0.2 , 0.11 ] ) ;
189
+ drag ( [ [ 390 , 220 ] , [ 300 , 250 ] ] ) ;
190
+ assertRange ( gd , [ 0.4486 , 0.2480 , 0.1453 ] ) ;
191
191
192
- return doubleClick ( pointPos [ 0 ] , pointPos [ 1 ] ) ;
193
- } ) . then ( function ( ) {
192
+ doubleClick ( pointPos [ 0 ] , pointPos [ 1 ] ) . then ( function ( ) {
194
193
assertRange ( gd , [ 0 , 0 , 0 ] ) ;
195
194
196
195
done ( ) ;
197
196
} ) ;
198
197
} ) ;
199
198
} ) ;
200
199
200
+ describe ( 'static plots' , function ( ) {
201
+ var mock = require ( '@mocks/ternary_simple.json' ) ;
202
+ var gd ;
203
+
204
+ beforeEach ( function ( done ) {
205
+ gd = createGraphDiv ( ) ;
206
+
207
+ var mockCopy = Lib . extendDeep ( { } , mock ) ;
208
+ var config = { staticPlot : true } ;
209
+
210
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout , config ) . then ( done ) ;
211
+ } ) ;
212
+
213
+ it ( 'should not respond to drag' , function ( done ) {
214
+ var range = [ 0.231 , 0.2 , 0.11 ] ;
215
+
216
+ assertRange ( gd , range ) ;
217
+
218
+ drag ( [ [ 390 , 220 ] , [ 300 , 250 ] ] ) ;
219
+ assertRange ( gd , range ) ;
220
+
221
+ doubleClick ( 390 , 220 ) . then ( function ( ) {
222
+ assertRange ( gd , range ) ;
223
+
224
+ done ( ) ;
225
+ } ) ;
226
+ } ) ;
227
+ } ) ;
228
+
201
229
function countTernarySubplot ( ) {
202
230
return d3 . selectAll ( '.ternary' ) . size ( ) ;
203
231
}
@@ -227,6 +255,19 @@ describe('ternary plots', function() {
227
255
} ) ;
228
256
}
229
257
258
+ function drag ( path ) {
259
+ var len = path . length ;
260
+
261
+ mouseEvent ( 'mousemove' , path [ 0 ] [ 0 ] , path [ 0 ] [ 1 ] ) ;
262
+ mouseEvent ( 'mousedown' , path [ 0 ] [ 0 ] , path [ 0 ] [ 1 ] ) ;
263
+
264
+ path . slice ( 1 , len ) . forEach ( function ( pt ) {
265
+ mouseEvent ( 'mousemove' , pt [ 0 ] , pt [ 1 ] ) ;
266
+ } ) ;
267
+
268
+ mouseEvent ( 'mouseup' , path [ len - 1 ] [ 0 ] , path [ len - 1 ] [ 1 ] ) ;
269
+ }
270
+
230
271
function assertRange ( gd , expected ) {
231
272
var ternary = gd . _fullLayout . ternary ;
232
273
var actual = [
0 commit comments