File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ describe('Test Plots', function() {
8
8
'use strict' ;
9
9
10
10
describe ( 'Plotly.supplyDefaults' , function ( ) {
11
+ function testSanitizeMarginsHasBeenCalledOnlyOnce ( gd ) {
12
+ spyOn ( Plots , 'sanitizeMargins' ) . and . callThrough ( ) ;
13
+ Plots . supplyDefaults ( gd ) ;
14
+ expect ( Plots . sanitizeMargins ) . toHaveBeenCalledTimes ( 1 ) ;
15
+ }
16
+
11
17
it ( 'should not throw an error when gd is a plain object' , function ( ) {
12
18
var height = 100 ,
13
19
gd = {
@@ -23,6 +29,39 @@ describe('Test Plots', function() {
23
29
expect ( gd . _fullLayout . width ) . toBe ( Plots . layoutAttributes . width . dflt ) ;
24
30
expect ( gd . _fullData ) . toBeDefined ( ) ;
25
31
} ) ;
32
+
33
+ it ( 'should call sanitizeMargins only once when both width and height are defined' , function ( ) {
34
+ var gd = {
35
+ layout : {
36
+ width : 100 ,
37
+ height : 100
38
+ }
39
+ } ;
40
+
41
+ testSanitizeMarginsHasBeenCalledOnlyOnce ( gd ) ;
42
+ } ) ;
43
+
44
+ it ( 'should call sanitizeMargins only once when autosize is false' , function ( ) {
45
+ var gd = {
46
+ layout : {
47
+ autosize : false ,
48
+ height : 100
49
+ }
50
+ } ;
51
+
52
+ testSanitizeMarginsHasBeenCalledOnlyOnce ( gd ) ;
53
+ } ) ;
54
+
55
+ it ( 'should call sanitizeMargins only once when autosize is true' , function ( ) {
56
+ var gd = {
57
+ layout : {
58
+ autosize : true ,
59
+ height : 100
60
+ }
61
+ } ;
62
+
63
+ testSanitizeMarginsHasBeenCalledOnlyOnce ( gd ) ;
64
+ } ) ;
26
65
} ) ;
27
66
28
67
describe ( 'Plots.supplyLayoutGlobalDefaults should' , function ( ) {
You can’t perform that action at this time.
0 commit comments