File tree 3 files changed +44
-1
lines changed
test/jasmine/bundle_tests
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) {
579
579
* Single-trace subplots (which have no `id`) such as pie, table, etc
580
580
* do not need to be collected because we just draw all visible traces.
581
581
*/
582
- var collectableSubplotTypes ;
583
582
function emptySubplotLists ( ) {
583
+ var collectableSubplotTypes = Registry . collectableSubplotTypes ;
584
584
var out = { } ;
585
585
var i , j ;
586
586
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ exports.layoutArrayRegexes = [];
31
31
exports . traceLayoutAttributes = { } ;
32
32
exports . localeRegistry = { } ;
33
33
exports . apiMethodRegistry = { } ;
34
+ exports . collectableSubplotTypes = null ;
34
35
35
36
/**
36
37
* Top-level register routine, exported as Plotly.register
@@ -72,6 +73,8 @@ exports.apiMethodRegistry = {};
72
73
*
73
74
*/
74
75
exports . register = function register ( _modules ) {
76
+ exports . collectableSubplotTypes = null ;
77
+
75
78
if ( ! _modules ) {
76
79
throw new Error ( 'No argument passed to Plotly.register.' ) ;
77
80
} 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