@@ -28,6 +28,10 @@ describe('Test scatterpolar trace defaults:', function() {
2828 expect ( traceOut . r ) . toEqual ( [ 1 , 2 , 3 , 4 , 5 ] ) ;
2929 expect ( traceOut . theta ) . toEqual ( [ 1 , 2 , 3 ] ) ;
3030 expect ( traceOut . _length ) . toBe ( 3 ) ;
31+ expect ( traceOut . r0 ) . toBeUndefined ( ) ;
32+ expect ( traceOut . dr ) . toBeUndefined ( ) ;
33+ expect ( traceOut . theta0 ) . toBeUndefined ( ) ;
34+ expect ( traceOut . dtheta ) . toBeUndefined ( ) ;
3135 } ) ;
3236
3337 it ( 'should not truncate *theta* when longer than *r*' , function ( ) {
@@ -40,6 +44,39 @@ describe('Test scatterpolar trace defaults:', function() {
4044 expect ( traceOut . r ) . toEqual ( [ 1 , 2 , 3 ] ) ;
4145 expect ( traceOut . theta ) . toEqual ( [ 1 , 2 , 3 , 4 , 5 ] ) ;
4246 expect ( traceOut . _length ) . toBe ( 3 ) ;
47+ expect ( traceOut . r0 ) . toBeUndefined ( ) ;
48+ expect ( traceOut . dr ) . toBeUndefined ( ) ;
49+ expect ( traceOut . theta0 ) . toBeUndefined ( ) ;
50+ expect ( traceOut . dtheta ) . toBeUndefined ( ) ;
51+ } ) ;
52+
53+ it ( 'should coerce *theta0* and *dtheta* when *theta* is not set' , function ( ) {
54+ _supply ( {
55+ r : [ 1 , 2 , 3 ]
56+ } ) ;
57+
58+ expect ( traceOut . r ) . toEqual ( [ 1 , 2 , 3 ] ) ;
59+ expect ( traceOut . theta ) . toBeUndefined ( ) ;
60+ expect ( traceOut . _length ) . toBe ( 3 ) ;
61+ expect ( traceOut . r0 ) . toBeUndefined ( ) ;
62+ expect ( traceOut . dr ) . toBeUndefined ( ) ;
63+ expect ( traceOut . theta0 ) . toBe ( 0 ) ;
64+ // its default value is computed later
65+ expect ( traceOut . dtheta ) . toBeUndefined ( ) ;
66+ } ) ;
67+
68+ it ( 'should coerce *r0* and *dr* when *r* is not set' , function ( ) {
69+ _supply ( {
70+ theta : [ 1 , 2 , 3 , 4 , 5 ]
71+ } ) ;
72+
73+ expect ( traceOut . r ) . toBeUndefined ( ) ;
74+ expect ( traceOut . theta ) . toEqual ( [ 1 , 2 , 3 , 4 , 5 ] ) ;
75+ expect ( traceOut . _length ) . toBe ( 5 ) ;
76+ expect ( traceOut . r0 ) . toBe ( 0 ) ;
77+ expect ( traceOut . dr ) . toBe ( 1 ) ;
78+ expect ( traceOut . theta0 ) . toBeUndefined ( ) ;
79+ expect ( traceOut . dtheta ) . toBeUndefined ( ) ;
4380 } ) ;
4481} ) ;
4582
0 commit comments