File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ var dfltConfig = require('./plot_config');
3131 * `layout.template` in another figure.
3232 */
3333exports . makeTemplate = function ( figure ) {
34- figure = Lib . extendDeep ( { _context : dfltConfig } , figure ) ;
34+ figure = Lib . extendDeep ( { _context : dfltConfig } , { data : figure . data , layout : figure . layout } ) ;
3535 Plots . supplyDefaults ( figure ) ;
3636 var data = figure . data || [ ] ;
3737 var layout = figure . layout || { } ;
Original file line number Diff line number Diff line change @@ -141,6 +141,33 @@ describe('makeTemplate', function() {
141141
142142 expect ( template ) . toEqual ( expected ) ;
143143 } ) ;
144+
145+ it ( 'works on DOM element' , function ( done ) {
146+ var mock = Lib . extendDeep ( { } , scatterFillMock ) ;
147+ var gd = createGraphDiv ( ) ;
148+
149+ Plotly . newPlot ( gd , mock )
150+ . then ( function ( ) {
151+ var template = Plotly . makeTemplate ( gd ) ;
152+ delete ( template . layout . xaxis ) ;
153+ delete ( template . layout . yaxis ) ;
154+ expect ( template ) . toEqual ( {
155+ data : { scatter : [
156+ { fill : 'tonext' , line : { shape : 'spline' } } ,
157+ { fill : 'tonext' } ,
158+ { fill : 'toself' }
159+ ] } ,
160+ layout : {
161+ title : 'Fill toself and tonext' ,
162+ width : 400 ,
163+ height : 400
164+ }
165+ } ) ;
166+ } )
167+ . catch ( failTest )
168+ . then ( destroyGraphDiv )
169+ . then ( done ) ;
170+ } ) ;
144171} ) ;
145172
146173// statics of template application are all covered by the template mock
You can’t perform that action at this time.
0 commit comments