@@ -75,28 +75,33 @@ describe('Test shapes:', function() {
75
75
76
76
describe ( 'Plotly.relayout' , function ( ) {
77
77
it ( 'should be able to add a shape' , function ( done ) {
78
+ var pathCount = countShapePaths ( ) ;
78
79
var index = countShapes ( gd ) ;
79
80
var shape = getRandomShape ( ) ;
80
81
81
82
Plotly . relayout ( gd , 'shapes[' + index + ']' , shape ) . then ( function ( ) {
82
83
expect ( countShapeLayers ( ) ) . toEqual ( 1 ) ;
84
+ expect ( countShapePaths ( ) ) . toEqual ( pathCount + 1 ) ;
83
85
expect ( getLastShape ( gd ) ) . toEqual ( shape ) ;
84
86
expect ( countShapes ( gd ) ) . toEqual ( index + 1 ) ;
85
87
} ) . then ( done ) ;
86
88
} ) ;
87
89
88
90
it ( 'should be able to remove a shape' , function ( done ) {
91
+ var pathCount = countShapePaths ( ) ;
89
92
var index = countShapes ( gd ) ;
90
93
var shape = getRandomShape ( ) ;
91
94
92
95
Plotly . relayout ( gd , 'shapes[' + index + ']' , shape ) . then ( function ( ) {
93
96
expect ( countShapeLayers ( ) ) . toEqual ( 1 ) ;
97
+ expect ( countShapePaths ( ) ) . toEqual ( pathCount + 1 ) ;
94
98
expect ( getLastShape ( gd ) ) . toEqual ( shape ) ;
95
99
expect ( countShapes ( gd ) ) . toEqual ( index + 1 ) ;
96
100
} ) . then ( function ( ) {
97
101
Plotly . relayout ( gd , 'shapes[' + index + ']' , 'remove' ) ;
98
102
} ) . then ( function ( ) {
99
103
expect ( countShapeLayers ( ) ) . toEqual ( 1 ) ;
104
+ expect ( countShapePaths ( ) ) . toEqual ( pathCount ) ;
100
105
expect ( countShapes ( gd ) ) . toEqual ( index ) ;
101
106
} ) . then ( done ) ;
102
107
} ) ;
0 commit comments