@@ -967,10 +967,13 @@ describe('Test sunburst tweening:', function() {
967
967
968
968
afterEach ( destroyGraphDiv ) ;
969
969
970
- function _run ( gd , v ) {
970
+ function _reset ( ) {
971
971
pathTweenFnLookup = { } ;
972
972
textTweenFnLookup = { } ;
973
+ }
973
974
975
+ function _run ( gd , v ) {
976
+ _reset ( ) ;
974
977
click ( gd , v ) ( ) ;
975
978
976
979
// 1 second more than the click transition duration
@@ -1002,7 +1005,7 @@ describe('Test sunburst tweening:', function() {
1002
1005
expect ( actual ) . toBe ( trim ( exp ) , msg + ' | node ' + id + ' @t=' + t ) ;
1003
1006
}
1004
1007
1005
- it ( 'should tween sector exit/update (case: branch, no maxdepth)' , function ( done ) {
1008
+ it ( 'should tween sector exit/update (case: click on branch, no maxdepth)' , function ( done ) {
1006
1009
var mock = {
1007
1010
data : [ {
1008
1011
type : 'sunburst' ,
@@ -1040,7 +1043,7 @@ describe('Test sunburst tweening:', function() {
1040
1043
. then ( done ) ;
1041
1044
} ) ;
1042
1045
1043
- it ( 'should tween sector enter/update (case: entry, no maxdepth)' , function ( done ) {
1046
+ it ( 'should tween sector enter/update (case: click on entry, no maxdepth)' , function ( done ) {
1044
1047
var mock = {
1045
1048
data : [ {
1046
1049
type : 'sunburst' ,
@@ -1079,7 +1082,7 @@ describe('Test sunburst tweening:', function() {
1079
1082
. then ( done ) ;
1080
1083
} ) ;
1081
1084
1082
- it ( 'should tween sector enter/update/exit (case: entry, maxdepth=2)' , function ( done ) {
1085
+ it ( 'should tween sector enter/update/exit (case: click on entry, maxdepth=2)' , function ( done ) {
1083
1086
var mock = {
1084
1087
data : [ {
1085
1088
type : 'sunburst' ,
@@ -1116,6 +1119,70 @@ describe('Test sunburst tweening:', function() {
1116
1119
. catch ( failTest )
1117
1120
. then ( done ) ;
1118
1121
} ) ;
1122
+
1123
+ it ( 'should tween sector enter/update/exit (case: click on entry, maxdepth=2, level=B)' , function ( done ) {
1124
+ var mock = {
1125
+ data : [ {
1126
+ type : 'sunburst' ,
1127
+ labels : [ 'Root' , 'A' , 'B' , 'b' , 'bb' ] ,
1128
+ parents : [ '' , 'Root' , 'Root' , 'B' , 'b' ] ,
1129
+ maxdepth : 2 ,
1130
+ level : 'B'
1131
+ } ]
1132
+ } ;
1133
+
1134
+ Plotly . plot ( gd , mock )
1135
+ . then ( _run ( gd , 1 ) )
1136
+ . then ( function ( ) {
1137
+ _assert ( 'exit b radially outward and to parent sector angle' , 'd' , 'b' ,
1138
+ 'M350,133.75L350,100A135,1350,1,0485,235.00000000000003' +
1139
+ 'L451.25,235.00000000000003A101.25,101.250,1,1350,133.75Z'
1140
+ ) ;
1141
+ _assert ( 'enter new entry radially outward' , 'd' , 'Root' ,
1142
+ 'M350,235A0,00,1,0350,235A0,00,1,0350,235Z' +
1143
+ 'M383.75,235A33.75,33.750,1,1316.25,235A33.75,33.750,1,1383.75,235Z'
1144
+ ) ;
1145
+ _assert ( 'enter A counterclockwise' , 'd' , 'A' ,
1146
+ 'M417.5,235L485,235A135,1350,0,0350,100L350,167.5A67.5,67.50,0,1417.5,235Z'
1147
+ ) ;
1148
+ _assert ( 'update B to new position' , 'd' , 'B' ,
1149
+ 'M350,201.25L350,133.75A101.25,101.250,1,0451.25,235.00000000000003' +
1150
+ 'L383.75,235A33.75,33.750,1,1350,201.25Z'
1151
+ ) ;
1152
+ } )
1153
+ . catch ( failTest )
1154
+ . then ( done ) ;
1155
+ } ) ;
1156
+
1157
+ /*
1158
+ it('should tween in sectors from new traces', function(done) {
1159
+ Plotly.plot(gd, [{type: 'sunburst'}])
1160
+ .then(_reset)
1161
+ .then(function() {
1162
+ return Plotly.animate(gd, [{
1163
+ type: 'sunburst',
1164
+ labels: ['Root', 'A', 'B', 'b'],
1165
+ parents: ['', 'Root', 'Root', 'B']
1166
+ }]);
1167
+ })
1168
+ .then(function() {
1169
+ _assert('enter entry from theta=0', 'd', 'Root',
1170
+ ''
1171
+ );
1172
+ // _assert('enter A from theta=0', 'd', 'A',
1173
+ // ''
1174
+ // );
1175
+ // _assert('enter B from theta=0', 'd', 'B',
1176
+ // ''
1177
+ // );
1178
+ // _assert('enter b from theta=0', 'd', 'b',
1179
+ // ''
1180
+ // );
1181
+ })
1182
+ .catch(failTest)
1183
+ .then(done);
1184
+ });
1185
+ */
1119
1186
} ) ;
1120
1187
1121
1188
describe ( 'Test sunburst interactions edge cases' , function ( ) {
0 commit comments