@@ -2048,109 +2048,41 @@ describe('Plotly.react and uirevision attributes', function() {
2048
2048
_run ( fig , editComponents , checkInitial , checkEdited ) . then ( done ) ;
2049
2049
} ) ;
2050
2050
2051
- it ( 'preserves sunburst level changes' , function ( done ) {
2052
- function assertLevel ( msg , exp ) {
2053
- expect ( gd . _fullData [ 0 ] . level ) . toBe ( exp , msg ) ;
2054
- }
2055
-
2056
- Plotly . react ( gd , [ {
2057
- type : 'sunburst' ,
2058
- labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' ] ,
2059
- parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' ] ,
2060
- uirevision : 1
2061
- } ] )
2062
- . then ( function ( ) {
2063
- assertLevel ( 'no set level at start' , undefined ) ;
2064
- } )
2065
- . then ( function ( ) {
2066
- var nodeSeth = d3Select ( '.slice:nth-child(2)' ) . node ( ) ;
2067
- mouseEvent ( 'click' , 0 , 0 , { element : nodeSeth } ) ;
2068
- } )
2069
- . then ( function ( ) {
2070
- assertLevel ( 'after clicking on Seth sector' , 'Seth' ) ;
2071
- } )
2072
- . then ( function ( ) {
2073
- return Plotly . react ( gd , [ {
2074
- type : 'sunburst' ,
2075
- labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' , 'Joe' ] ,
2076
- parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' , 'Seth' ] ,
2077
- uirevision : 1
2078
- } ] ) ;
2079
- } )
2080
- . then ( function ( ) {
2081
- assertLevel ( 'after reacting with new data, but with same uirevision' , 'Seth' ) ;
2082
- } )
2083
- . then ( done , done . fail ) ;
2084
- } ) ;
2085
-
2086
- it ( 'preserves treemap level changes' , function ( done ) {
2087
- function assertLevel ( msg , exp ) {
2088
- expect ( gd . _fullData [ 0 ] . level ) . toBe ( exp , msg ) ;
2089
- }
2090
-
2091
- Plotly . react ( gd , [ {
2092
- type : 'treemap' ,
2093
- labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' ] ,
2094
- parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' ] ,
2095
- uirevision : 1
2096
- } ] )
2097
- . then ( function ( ) {
2098
- assertLevel ( 'no set level at start' , undefined ) ;
2099
- } )
2100
- . then ( function ( ) {
2101
- var nodeSeth = d3Select ( '.slice:nth-child(2)' ) . node ( ) ;
2102
- mouseEvent ( 'click' , 0 , 0 , { element : nodeSeth } ) ;
2103
- } )
2104
- . then ( function ( ) {
2105
- assertLevel ( 'after clicking on Seth sector' , 'Seth' ) ;
2106
- } )
2107
- . then ( function ( ) {
2108
- return Plotly . react ( gd , [ {
2109
- type : 'treemap' ,
2110
- labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' , 'Joe' ] ,
2111
- parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' , 'Seth' ] ,
2112
- uirevision : 1
2113
- } ] ) ;
2114
- } )
2115
- . then ( function ( ) {
2116
- assertLevel ( 'after reacting with new data, but with same uirevision' , 'Seth' ) ;
2117
- } )
2118
- . then ( done , done . fail ) ;
2119
- } ) ;
2120
-
2121
- it ( 'preserves icicle level changes' , function ( done ) {
2122
- function assertLevel ( msg , exp ) {
2123
- expect ( gd . _fullData [ 0 ] . level ) . toBe ( exp , msg ) ;
2124
- }
2051
+ [ 'sunburst' , 'icicle' , 'treemap' ] . forEach ( function ( type ) {
2052
+ it ( 'preserves ' + type + ' level changes' , function ( done ) {
2053
+ function assertLevel ( msg , exp ) {
2054
+ expect ( gd . _fullData [ 0 ] . level ) . toBe ( exp , msg ) ;
2055
+ }
2125
2056
2126
- Plotly . react ( gd , [ {
2127
- type : 'icicle' ,
2128
- labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' ] ,
2129
- parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' ] ,
2130
- uirevision : 1
2131
- } ] )
2132
- . then ( function ( ) {
2133
- assertLevel ( 'no set level at start' , undefined ) ;
2134
- } )
2135
- . then ( function ( ) {
2136
- var nodeSeth = d3Select ( '.slice:nth-child(2)' ) . node ( ) ;
2137
- mouseEvent ( 'click' , 0 , 0 , { element : nodeSeth } ) ;
2138
- } )
2139
- . then ( function ( ) {
2140
- assertLevel ( 'after clicking on Seth sector' , 'Seth' ) ;
2141
- } )
2142
- . then ( function ( ) {
2143
- return Plotly . react ( gd , [ {
2144
- type : 'icicle' ,
2145
- labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' , 'Joe' ] ,
2146
- parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' , 'Seth' ] ,
2057
+ Plotly . react ( gd , [ {
2058
+ type : type ,
2059
+ labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' ] ,
2060
+ parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' ] ,
2147
2061
uirevision : 1
2148
- } ] ) ;
2149
- } )
2150
- . then ( function ( ) {
2151
- assertLevel ( 'after reacting with new data, but with same uirevision' , 'Seth' ) ;
2152
- } )
2153
- . then ( done , done . fail ) ;
2062
+ } ] )
2063
+ . then ( function ( ) {
2064
+ assertLevel ( 'no set level at start' , undefined ) ;
2065
+ } )
2066
+ . then ( function ( ) {
2067
+ var nodeSeth = d3Select ( '.slice:nth-child(2)' ) . node ( ) ;
2068
+ mouseEvent ( 'click' , 0 , 0 , { element : nodeSeth } ) ;
2069
+ } )
2070
+ . then ( function ( ) {
2071
+ assertLevel ( 'after clicking on Seth sector' , 'Seth' ) ;
2072
+ } )
2073
+ . then ( function ( ) {
2074
+ return Plotly . react ( gd , [ {
2075
+ type : type ,
2076
+ labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' , 'Joe' ] ,
2077
+ parents : [ '' , 'Eve' , 'Eve' , 'Seth' , 'Seth' , 'Eve' , 'Eve' , 'Awan' , 'Eve' , 'Seth' ] ,
2078
+ uirevision : 1
2079
+ } ] ) ;
2080
+ } )
2081
+ . then ( function ( ) {
2082
+ assertLevel ( 'after reacting with new data, but with same uirevision' , 'Seth' ) ;
2083
+ } )
2084
+ . then ( done , done . fail ) ;
2085
+ } ) ;
2154
2086
} ) ;
2155
2087
} ) ;
2156
2088
0 commit comments