File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed
test/jasmine/bundle_tests Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -579,8 +579,8 @@ function getTraceUids(oldFullData, newData) {
579579 * Single-trace subplots (which have no `id`) such as pie, table, etc
580580 * do not need to be collected because we just draw all visible traces.
581581 */
582- var collectableSubplotTypes ;
583582function emptySubplotLists ( ) {
583+ var collectableSubplotTypes = Registry . collectableSubplotTypes ;
584584 var out = { } ;
585585 var i , j ;
586586
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ exports.layoutArrayRegexes = [];
3131exports . traceLayoutAttributes = { } ;
3232exports . localeRegistry = { } ;
3333exports . apiMethodRegistry = { } ;
34+ exports . collectableSubplotTypes = null ;
3435
3536/**
3637 * Top-level register routine, exported as Plotly.register
@@ -72,6 +73,8 @@ exports.apiMethodRegistry = {};
7273 *
7374 */
7475exports . register = function register ( _modules ) {
76+ exports . collectableSubplotTypes = null ;
77+
7578 if ( ! _modules ) {
7679 throw new Error ( 'No argument passed to Plotly.register.' ) ;
7780 } else if ( _modules && ! Array . isArray ( _modules ) ) {
Original file line number Diff line number Diff line change 1+ var Plotly = require ( '@lib/core' ) ;
2+
3+ var d3 = require ( 'd3' ) ;
4+ var createGraphDiv = require ( '../assets/create_graph_div' ) ;
5+ var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
6+ var failTest = require ( '../assets/fail_test' ) ;
7+
8+ describe ( 'Dynamic @lib/ module imports' , function ( ) {
9+ var gd ;
10+
11+ afterEach ( destroyGraphDiv ) ;
12+
13+ it ( 'should work' , function ( done ) {
14+ gd = createGraphDiv ( ) ;
15+
16+ Plotly . newPlot ( gd , [ {
17+ y : [ 1 , 2 , 1 ]
18+ } ] )
19+ . then ( function ( ) {
20+ // N.B. from a different subplot type
21+ // more info in:
22+ // https://github.com/plotly/plotly.js/issues/3428
23+ var ScatterPolar = require ( '@lib/scatterpolar' ) ;
24+ Plotly . register ( ScatterPolar ) ;
25+ } )
26+ . then ( function ( ) {
27+ return Plotly . newPlot ( gd , [ {
28+ type : 'scatterpolar' ,
29+ r : [ 1 , 2 , 1 ]
30+ } ] ) ;
31+ } )
32+ . then ( function ( ) {
33+ var polarLayer = d3 . select ( '.polarlayer' ) ;
34+ expect ( polarLayer . size ( ) ) . toBe ( 1 , 'one polar layer' ) ;
35+ expect ( polarLayer . selectAll ( '.trace' ) . size ( ) ) . toBe ( 1 , 'one scatterpolar trace' ) ;
36+ } )
37+ . catch ( failTest )
38+ . then ( done ) ;
39+ } ) ;
40+ } ) ;
You can’t perform that action at this time.
0 commit comments