@@ -6,6 +6,7 @@ var d3 = require('d3');
6
6
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
7
7
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
8
8
var supplyAllDefaults = require ( '../assets/supply_defaults' ) ;
9
+ var failTest = require ( '../assets/fail_test' ) ;
9
10
10
11
11
12
describe ( 'Test Plots' , function ( ) {
@@ -369,7 +370,7 @@ describe('Test Plots', function() {
369
370
. then ( done ) ;
370
371
} ) ;
371
372
372
- afterEach ( destroyGraphDiv ) ;
373
+ afterAll ( destroyGraphDiv ) ;
373
374
374
375
it ( 'should resize the plot clip' , function ( ) {
375
376
var uid = gd . _fullLayout . _uid ;
@@ -385,6 +386,7 @@ describe('Test Plots', function() {
385
386
386
387
it ( 'should resize the main svgs' , function ( ) {
387
388
var mainSvgs = document . getElementsByClassName ( 'main-svg' ) ;
389
+ expect ( mainSvgs . length ) . toBe ( 2 ) ;
388
390
389
391
for ( var i = 0 ; i < mainSvgs . length ; i ++ ) {
390
392
var svg = mainSvgs [ i ] ,
@@ -397,6 +399,9 @@ describe('Test Plots', function() {
397
399
} ) ;
398
400
399
401
it ( 'should update the axis scales' , function ( ) {
402
+ var mainSvgs = document . getElementsByClassName ( 'main-svg' ) ;
403
+ expect ( mainSvgs . length ) . toBe ( 2 ) ;
404
+
400
405
var fullLayout = gd . _fullLayout ,
401
406
plotinfo = fullLayout . _plots . xy ;
402
407
@@ -406,6 +411,18 @@ describe('Test Plots', function() {
406
411
expect ( plotinfo . xaxis . _length ) . toEqual ( 240 ) ;
407
412
expect ( plotinfo . yaxis . _length ) . toEqual ( 220 ) ;
408
413
} ) ;
414
+
415
+ it ( 'should allow resizing by plot ID' , function ( done ) {
416
+ var mainSvgs = document . getElementsByClassName ( 'main-svg' ) ;
417
+ expect ( mainSvgs . length ) . toBe ( 2 ) ;
418
+
419
+ expect ( typeof gd . id ) . toBe ( 'string' ) ;
420
+ expect ( gd . id ) . toBeTruthy ( ) ;
421
+
422
+ Plotly . Plots . resize ( gd . id )
423
+ . catch ( failTest )
424
+ . then ( done ) ;
425
+ } ) ;
409
426
} ) ;
410
427
411
428
describe ( 'Plots.purge' , function ( ) {
0 commit comments