@@ -896,7 +896,7 @@ describe('Test plot api', function() {
896
896
} ) ;
897
897
} ) ;
898
898
899
- describe ( 'cleanData' , function ( ) {
899
+ describe ( 'cleanData & cleanLayout ' , function ( ) {
900
900
var gd ;
901
901
902
902
beforeEach ( function ( ) {
@@ -1039,6 +1039,36 @@ describe('Test plot api', function() {
1039
1039
expect ( trace1 . transforms . length ) . toEqual ( 1 ) ;
1040
1040
expect ( trace1 . transforms [ 0 ] . target ) . toEqual ( 'y' ) ;
1041
1041
} ) ;
1042
+
1043
+ it ( 'should cleanup annotations / shapes refs' , function ( ) {
1044
+ var data = [ { } ] ;
1045
+
1046
+ var layout = {
1047
+ annotations : [
1048
+ { ref : 'paper' } ,
1049
+ null ,
1050
+ { xref : 'x02' , yref : 'y1' }
1051
+ ] ,
1052
+ shapes : [
1053
+ { xref : 'y' , yref : 'x' } ,
1054
+ null ,
1055
+ { xref : 'x03' , yref : 'y1' }
1056
+ ]
1057
+ } ;
1058
+
1059
+ Plotly . plot ( gd , data , layout ) ;
1060
+
1061
+ expect ( gd . layout . annotations [ 0 ] ) . toEqual ( { xref : 'paper' , yref : 'paper' } ) ;
1062
+ expect ( gd . layout . annotations [ 1 ] ) . toEqual ( null ) ;
1063
+ expect ( gd . layout . annotations [ 2 ] ) . toEqual ( { xref : 'x2' , yref : 'y' } ) ;
1064
+
1065
+ expect ( gd . layout . shapes [ 0 ] . xref ) . toBeUndefined ( ) ;
1066
+ expect ( gd . layout . shapes [ 0 ] . yref ) . toBeUndefined ( ) ;
1067
+ expect ( gd . layout . shapes [ 1 ] ) . toEqual ( null ) ;
1068
+ expect ( gd . layout . shapes [ 2 ] . xref ) . toEqual ( 'x3' ) ;
1069
+ expect ( gd . layout . shapes [ 2 ] . yref ) . toEqual ( 'y' ) ;
1070
+
1071
+ } ) ;
1042
1072
} ) ;
1043
1073
1044
1074
describe ( 'Plotly.newPlot' , function ( ) {
0 commit comments