File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,48 @@ function runTests(transitionDuration) {
127
127
} ) . catch ( fail ) . then ( done ) ;
128
128
} ) ;
129
129
130
+ it ( 'transitions a shape' , function ( done ) {
131
+ function getPath ( ) {
132
+ return gd . _fullLayout . _shapeUpperLayer . select ( 'path' ) . node ( ) ;
133
+ }
134
+ var p1 , p2 , d1 , d2 ;
135
+
136
+ Plotly . relayout ( gd , {
137
+ shapes : [ {
138
+ type : 'circle' ,
139
+ xref : 'x' ,
140
+ yref : 'y' ,
141
+ x0 : 0 ,
142
+ y0 : 0 ,
143
+ x1 : 2 ,
144
+ y1 : 2 ,
145
+ opacity : 0.2 ,
146
+ fillcolor : 'blue' ,
147
+ line : { color : 'blue' }
148
+ } ]
149
+ } ) . then ( function ( ) {
150
+ p1 = getPath ( ) ;
151
+ d1 = p1 . getAttribute ( 'd' ) ;
152
+
153
+ return Plots . transition ( gd , null , {
154
+ 'shapes[0].x0' : 1 ,
155
+ 'shapes[0].y0' : 1 ,
156
+ } , [ ] ,
157
+ { redraw : true , duration : transitionDuration } ,
158
+ { duration : transitionDuration , easing : 'cubic-in-out' }
159
+ ) ;
160
+ } ) . then ( function ( ) {
161
+ p2 = getPath ( ) ;
162
+ d2 = p2 . getAttribute ( 'd' ) ;
163
+
164
+ // If object constancy is implemented, this will then be *equal*:
165
+ expect ( p1 ) . not . toBe ( p2 ) ;
166
+
167
+ expect ( d1 ) . not . toEqual ( d2 ) ;
168
+ } ) . catch ( fail ) . then ( done ) ;
169
+ } ) ;
170
+
171
+
130
172
it ( 'transitions a transform' , function ( done ) {
131
173
Plotly . restyle ( gd , {
132
174
'transforms[0]' : {
You can’t perform that action at this time.
0 commit comments