File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -116,8 +116,8 @@ mutable struct Plot
116116
117117 function Plot (
118118 data:: Union{Config, Vector{Config}} ,
119- layout:: Config = Defaults. layout[],
120- config:: Config = Defaults. config[];
119+ layout:: Config = copy ( Defaults. layout[]) ,
120+ config:: Config = copy ( Defaults. config[]) ;
121121 # kw
122122 id:: AbstractString = randstring (10 ),
123123 js:: Cobweb.Javascript = Cobweb. Javascript (" console.log('plot created!')" )
Original file line number Diff line number Diff line change 11using PlotlyLight
2+ using PlotlyLight. Defaults
23using JSON3
34using Test
45
@@ -12,6 +13,18 @@ using Test
1213 p (Config (x= 1 : 10 ,y= rand (10 )))
1314 @test length (p. data) == 2
1415end
16+ # -----------------------------------------------------------------------------# defaults
17+ @testset " defaults" begin
18+ old_layout_default = copy (Defaults. layout[])
19+ old_config_default = copy (Defaults. config[])
20+ p = Plot ()
21+ p. layout. xaxis. showgrid = false
22+ p. config. editable = true
23+ # make sure that mutation of layout and config of one plot has no effect on
24+ # global defaults
25+ @test Defaults. layout[] == old_layout_default
26+ @test Defaults. config[] == old_config_default
27+ end
1528# -----------------------------------------------------------------------------# src
1629@testset " src" begin
1730 p = Plot (Config (y= 1 : 10 ))
You can’t perform that action at this time.
0 commit comments