@@ -6,6 +6,7 @@ var d3 = require('d3');
66var createGraphDiv = require ( '../assets/create_graph_div' ) ;
77var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
88var supplyAllDefaults = require ( '../assets/supply_defaults' ) ;
9+ var failTest = require ( '../assets/fail_test' ) ;
910
1011
1112describe ( 'Test Plots' , function ( ) {
@@ -369,7 +370,7 @@ describe('Test Plots', function() {
369370 . then ( done ) ;
370371 } ) ;
371372
372- afterEach ( destroyGraphDiv ) ;
373+ afterAll ( destroyGraphDiv ) ;
373374
374375 it ( 'should resize the plot clip' , function ( ) {
375376 var uid = gd . _fullLayout . _uid ;
@@ -385,6 +386,7 @@ describe('Test Plots', function() {
385386
386387 it ( 'should resize the main svgs' , function ( ) {
387388 var mainSvgs = document . getElementsByClassName ( 'main-svg' ) ;
389+ expect ( mainSvgs . length ) . toBe ( 2 ) ;
388390
389391 for ( var i = 0 ; i < mainSvgs . length ; i ++ ) {
390392 var svg = mainSvgs [ i ] ,
@@ -397,6 +399,9 @@ describe('Test Plots', function() {
397399 } ) ;
398400
399401 it ( 'should update the axis scales' , function ( ) {
402+ var mainSvgs = document . getElementsByClassName ( 'main-svg' ) ;
403+ expect ( mainSvgs . length ) . toBe ( 2 ) ;
404+
400405 var fullLayout = gd . _fullLayout ,
401406 plotinfo = fullLayout . _plots . xy ;
402407
@@ -406,6 +411,18 @@ describe('Test Plots', function() {
406411 expect ( plotinfo . xaxis . _length ) . toEqual ( 240 ) ;
407412 expect ( plotinfo . yaxis . _length ) . toEqual ( 220 ) ;
408413 } ) ;
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+ } ) ;
409426 } ) ;
410427
411428 describe ( 'Plots.purge' , function ( ) {
0 commit comments