@@ -1915,146 +1915,174 @@ describe('Test axes', function() {
1915
1915
afterEach ( destroyGraphDiv ) ;
1916
1916
1917
1917
describe ( 'setting, or not setting categoryorder if it is not explicitly declared' , function ( ) {
1918
- it ( 'should set categoryorder to default if categoryorder and categoryarray are not supplied' , function ( ) {
1918
+ it ( 'should set categoryorder to default if categoryorder and categoryarray are not supplied' , function ( done ) {
1919
1919
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , { xaxis : { type : 'category' } } )
1920
1920
. then ( function ( ) {
1921
1921
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'trace' ) ;
1922
1922
expect ( gd . _fullLayout . xaxis . categorarray ) . toBe ( undefined ) ;
1923
- } ) ;
1923
+ } )
1924
+ . catch ( failTest )
1925
+ . then ( done ) ;
1924
1926
} ) ;
1925
1927
1926
- it ( 'should set categoryorder to default even if type is not set to category explicitly' , function ( ) {
1928
+ it ( 'should set categoryorder to default even if type is not set to category explicitly' , function ( done ) {
1927
1929
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] )
1928
1930
. then ( function ( ) {
1929
1931
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'trace' ) ;
1930
1932
expect ( gd . _fullLayout . xaxis . categorarray ) . toBe ( undefined ) ;
1931
- } ) ;
1933
+ } )
1934
+ . catch ( failTest )
1935
+ . then ( done ) ;
1932
1936
} ) ;
1933
1937
1934
- it ( 'should NOT set categoryorder to default if type is not category' , function ( ) {
1938
+ it ( 'should NOT set categoryorder to default if type is not category' , function ( done ) {
1935
1939
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] )
1936
1940
. then ( function ( ) {
1937
1941
expect ( gd . _fullLayout . yaxis . categoryorder ) . toBe ( undefined ) ;
1938
1942
expect ( gd . _fullLayout . xaxis . categorarray ) . toBe ( undefined ) ;
1939
- } ) ;
1943
+ } )
1944
+ . catch ( failTest )
1945
+ . then ( done ) ;
1940
1946
} ) ;
1941
1947
1942
- it ( 'should set categoryorder to default if type is overridden to be category' , function ( ) {
1948
+ it ( 'should set categoryorder to default if type is overridden to be category' , function ( done ) {
1943
1949
Plotly . plot ( gd , [ { x : [ 1 , 2 , 3 , 4 , 5 ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , { yaxis : { type : 'category' } } )
1944
1950
. then ( function ( ) {
1945
1951
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( undefined ) ;
1946
1952
expect ( gd . _fullLayout . yaxis . categorarray ) . toBe ( undefined ) ;
1947
1953
expect ( gd . _fullLayout . yaxis . categoryorder ) . toBe ( 'trace' ) ;
1948
1954
expect ( gd . _fullLayout . yaxis . categorarray ) . toBe ( undefined ) ;
1949
- } ) ;
1955
+ } )
1956
+ . catch ( failTest )
1957
+ . then ( done ) ;
1950
1958
} ) ;
1951
1959
} ) ;
1952
1960
1953
1961
describe ( 'setting categoryorder to "array"' , function ( ) {
1954
- it ( 'should leave categoryorder on "array" if it is supplied' , function ( ) {
1962
+ it ( 'should leave categoryorder on "array" if it is supplied' , function ( done ) {
1955
1963
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
1956
1964
xaxis : { type : 'category' , categoryorder : 'array' , categoryarray : [ 'b' , 'a' , 'd' , 'e' , 'c' ] }
1957
1965
} )
1958
1966
. then ( function ( ) {
1959
1967
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'array' ) ;
1960
1968
expect ( gd . _fullLayout . xaxis . categoryarray ) . toEqual ( [ 'b' , 'a' , 'd' , 'e' , 'c' ] ) ;
1961
- } ) ;
1969
+ } )
1970
+ . catch ( failTest )
1971
+ . then ( done ) ;
1962
1972
} ) ;
1963
1973
1964
- it ( 'should switch categoryorder on "array" if it is not supplied but categoryarray is supplied' , function ( ) {
1974
+ it ( 'should switch categoryorder on "array" if it is not supplied but categoryarray is supplied' , function ( done ) {
1965
1975
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
1966
1976
xaxis : { type : 'category' , categoryarray : [ 'b' , 'a' , 'd' , 'e' , 'c' ] }
1967
1977
} )
1968
1978
. then ( function ( ) {
1969
1979
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'array' ) ;
1970
1980
expect ( gd . _fullLayout . xaxis . categoryarray ) . toEqual ( [ 'b' , 'a' , 'd' , 'e' , 'c' ] ) ;
1971
- } ) ;
1981
+ } )
1982
+ . catch ( failTest )
1983
+ . then ( done ) ;
1972
1984
} ) ;
1973
1985
1974
- it ( 'should revert categoryorder to "trace" if "array" is supplied but there is no list' , function ( ) {
1986
+ it ( 'should revert categoryorder to "trace" if "array" is supplied but there is no list' , function ( done ) {
1975
1987
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
1976
1988
xaxis : { type : 'category' , categoryorder : 'array' }
1977
1989
} )
1978
1990
. then ( function ( ) {
1979
1991
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'trace' ) ;
1980
1992
expect ( gd . _fullLayout . xaxis . categorarray ) . toBe ( undefined ) ;
1981
- } ) ;
1993
+ } )
1994
+ . catch ( failTest )
1995
+ . then ( done ) ;
1982
1996
} ) ;
1983
1997
} ) ;
1984
1998
1985
1999
describe ( 'do not set categoryorder to "array" if list exists but empty' , function ( ) {
1986
- it ( 'should switch categoryorder to default if list is not supplied' , function ( ) {
2000
+ it ( 'should switch categoryorder to default if list is not supplied' , function ( done ) {
1987
2001
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
1988
2002
xaxis : { type : 'category' , categoryorder : 'array' , categoryarray : [ ] }
1989
2003
} )
1990
2004
. then ( function ( ) {
1991
2005
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'trace' ) ;
1992
2006
expect ( gd . _fullLayout . xaxis . categoryarray ) . toEqual ( [ ] ) ;
1993
- } ) ;
2007
+ } )
2008
+ . catch ( failTest )
2009
+ . then ( done ) ;
1994
2010
} ) ;
1995
2011
1996
- it ( 'should not switch categoryorder on "array" if categoryarray is supplied but empty' , function ( ) {
2012
+ it ( 'should not switch categoryorder on "array" if categoryarray is supplied but empty' , function ( done ) {
1997
2013
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
1998
2014
xaxis : { type : 'category' , categoryarray : [ ] }
1999
2015
} )
2000
2016
. then ( function ( ) {
2001
2017
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'trace' ) ;
2002
2018
expect ( gd . _fullLayout . xaxis . categoryarray ) . toEqual ( undefined ) ;
2003
- } ) ;
2019
+ } )
2020
+ . catch ( failTest )
2021
+ . then ( done ) ;
2004
2022
} ) ;
2005
2023
} ) ;
2006
2024
2007
2025
describe ( 'do NOT set categoryorder to "array" if it has some other proper value' , function ( ) {
2008
- it ( 'should use specified categoryorder if it is supplied even if categoryarray exists' , function ( ) {
2026
+ it ( 'should use specified categoryorder if it is supplied even if categoryarray exists' , function ( done ) {
2009
2027
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
2010
2028
xaxis : { type : 'category' , categoryorder : 'trace' , categoryarray : [ 'b' , 'a' , 'd' , 'e' , 'c' ] }
2011
2029
} )
2012
2030
. then ( function ( ) {
2013
2031
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'trace' ) ;
2014
2032
expect ( gd . _fullLayout . xaxis . categoryarray ) . toBe ( undefined ) ;
2015
- } ) ;
2033
+ } )
2034
+ . catch ( failTest )
2035
+ . then ( done ) ;
2016
2036
} ) ;
2017
2037
2018
- it ( 'should use specified categoryorder if it is supplied even if categoryarray exists' , function ( ) {
2038
+ it ( 'should use specified categoryorder if it is supplied even if categoryarray exists' , function ( done ) {
2019
2039
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
2020
2040
xaxis : { type : 'category' , categoryorder : 'category ascending' , categoryarray : [ 'b' , 'a' , 'd' , 'e' , 'c' ] }
2021
2041
} )
2022
2042
. then ( function ( ) {
2023
2043
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'category ascending' ) ;
2024
2044
expect ( gd . _fullLayout . xaxis . categoryarray ) . toBe ( undefined ) ;
2025
- } ) ;
2045
+ } )
2046
+ . catch ( failTest )
2047
+ . then ( done ) ;
2026
2048
} ) ;
2027
2049
2028
- it ( 'should use specified categoryorder if it is supplied even if categoryarray exists' , function ( ) {
2050
+ it ( 'should use specified categoryorder if it is supplied even if categoryarray exists' , function ( done ) {
2029
2051
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
2030
2052
xaxis : { type : 'category' , categoryorder : 'category descending' , categoryarray : [ 'b' , 'a' , 'd' , 'e' , 'c' ] }
2031
2053
} )
2032
2054
. then ( function ( ) {
2033
2055
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'category descending' ) ;
2034
2056
expect ( gd . _fullLayout . xaxis . categoryarray ) . toBe ( undefined ) ;
2035
- } ) ;
2057
+ } )
2058
+ . catch ( failTest )
2059
+ . then ( done ) ;
2036
2060
} ) ;
2037
2061
} ) ;
2038
2062
2039
2063
describe ( 'setting categoryorder to the default if the value is unexpected' , function ( ) {
2040
- it ( 'should switch categoryorder to "trace" if mode is supplied but invalid' , function ( ) {
2064
+ it ( 'should switch categoryorder to "trace" if mode is supplied but invalid' , function ( done ) {
2041
2065
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
2042
2066
xaxis : { type : 'category' , categoryorder : 'invalid value' }
2043
2067
} )
2044
2068
. then ( function ( ) {
2045
2069
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'trace' ) ;
2046
2070
expect ( gd . _fullLayout . xaxis . categoryarray ) . toBe ( undefined ) ;
2047
- } ) ;
2071
+ } )
2072
+ . catch ( failTest )
2073
+ . then ( done ) ;
2048
2074
} ) ;
2049
2075
2050
- it ( 'should switch categoryorder to "array" if mode is supplied but invalid and list is supplied' , function ( ) {
2076
+ it ( 'should switch categoryorder to "array" if mode is supplied but invalid and list is supplied' , function ( done ) {
2051
2077
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , {
2052
2078
xaxis : { type : 'category' , categoryorder : 'invalid value' , categoryarray : [ 'b' , 'a' , 'd' , 'e' , 'c' ] }
2053
2079
} )
2054
2080
. then ( function ( ) {
2055
2081
expect ( gd . _fullLayout . xaxis . categoryorder ) . toBe ( 'array' ) ;
2056
2082
expect ( gd . _fullLayout . xaxis . categoryarray ) . toEqual ( [ 'b' , 'a' , 'd' , 'e' , 'c' ] ) ;
2057
- } ) ;
2083
+ } )
2084
+ . catch ( failTest )
2085
+ . then ( done ) ;
2058
2086
} ) ;
2059
2087
} ) ;
2060
2088
} ) ;
@@ -2069,13 +2097,15 @@ describe('Test axes', function() {
2069
2097
afterEach ( destroyGraphDiv ) ;
2070
2098
2071
2099
describe ( 'a category has the same value of one of the auto range computed extreme' , function ( ) {
2072
- it ( 'should compute the right range for X axis' , function ( ) {
2100
+ it ( 'should compute the right range for X axis' , function ( done ) {
2073
2101
Plotly . plot ( gd , [ { x : [ '0' , '-0.5' , '3.5' , 'Not Known' ] , y : [ '1.0' , '1.0' , '2.0' , '1.0' ] , type : 'bar' } ] , {
2074
2102
xaxis : { type : 'category' , autorange : true }
2075
2103
} )
2076
2104
. then ( function ( ) {
2077
2105
expect ( gd . _fullLayout . xaxis . _rl ) . toEqual ( [ - 0.5 , 3.5 ] ) ;
2078
- } ) ;
2106
+ } )
2107
+ . catch ( failTest )
2108
+ . then ( done ) ;
2079
2109
} ) ;
2080
2110
} ) ;
2081
2111
} ) ;
@@ -2090,7 +2120,7 @@ describe('Test axes', function() {
2090
2120
2091
2121
afterEach ( destroyGraphDiv ) ;
2092
2122
2093
- it ( 'should set defaults on bad inputs' , function ( ) {
2123
+ it ( 'should set defaults on bad inputs' , function ( done ) {
2094
2124
var layout = {
2095
2125
yaxis : {
2096
2126
ticklen : 'invalid' ,
@@ -2112,10 +2142,12 @@ describe('Test axes', function() {
2112
2142
expect ( yaxis . showticklabels ) . toBe ( true ) ;
2113
2143
expect ( yaxis . tickfont ) . toEqual ( { family : '"Open Sans", verdana, arial, sans-serif' , size : 12 , color : '#444' } ) ;
2114
2144
expect ( yaxis . tickangle ) . toBe ( 'auto' ) ;
2115
- } ) ;
2145
+ } )
2146
+ . catch ( failTest )
2147
+ . then ( done ) ;
2116
2148
} ) ;
2117
2149
2118
- it ( 'should use valid inputs' , function ( ) {
2150
+ it ( 'should use valid inputs' , function ( done ) {
2119
2151
var layout = {
2120
2152
yaxis : {
2121
2153
ticklen : 10 ,
@@ -2137,10 +2169,12 @@ describe('Test axes', function() {
2137
2169
expect ( yaxis . showticklabels ) . toBe ( true ) ;
2138
2170
expect ( yaxis . tickfont ) . toEqual ( { family : 'Garamond' , size : 72 , color : '#0FF' } ) ;
2139
2171
expect ( yaxis . tickangle ) . toBe ( - 20 ) ;
2140
- } ) ;
2172
+ } )
2173
+ . catch ( failTest )
2174
+ . then ( done ) ;
2141
2175
} ) ;
2142
2176
2143
- it ( 'should conditionally coerce based on showticklabels' , function ( ) {
2177
+ it ( 'should conditionally coerce based on showticklabels' , function ( done ) {
2144
2178
var layout = {
2145
2179
yaxis : {
2146
2180
showticklabels : false ,
@@ -2152,7 +2186,9 @@ describe('Test axes', function() {
2152
2186
. then ( function ( ) {
2153
2187
var yaxis = gd . _fullLayout . yaxis ;
2154
2188
expect ( yaxis . tickangle ) . toBeUndefined ( ) ;
2155
- } ) ;
2189
+ } )
2190
+ . catch ( failTest )
2191
+ . then ( done ) ;
2156
2192
} ) ;
2157
2193
} ) ;
2158
2194
0 commit comments