@@ -20,29 +20,43 @@ describe('Test histogram2d', function() {
2020 traceOut = { } ;
2121 } ) ;
2222
23- it ( 'should set zsmooth to false when zsmooth is empty ' , function ( ) {
23+ it ( 'should quit early if there is no data ' , function ( ) {
2424 traceIn = { } ;
2525 supplyDefaults ( traceIn , traceOut , '' , { } ) ;
26+ expect ( traceOut . visible ) . toBe ( false ) ;
27+ [ 'zsmooth' , 'xgap' , 'ygap' , 'calendar' ] . forEach ( function ( v ) {
28+ expect ( traceOut [ v ] ) . toBeUndefined ( v ) ;
29+ } ) ;
30+ } ) ;
31+
32+ it ( 'should set zsmooth to false when zsmooth is empty' , function ( ) {
33+ traceIn = { x : [ 1 , 2 ] , y : [ 1 , 2 ] } ;
34+ supplyDefaults ( traceIn , traceOut , '' , { } ) ;
35+ expect ( traceOut . visible ) . not . toBe ( false ) ;
2636 expect ( traceOut . zsmooth ) . toBe ( false ) ;
2737 } ) ;
2838
2939 it ( 'doesnt step on zsmooth when zsmooth is set' , function ( ) {
3040 traceIn = {
41+ x : [ 1 , 2 ] ,
42+ y : [ 1 , 2 ] ,
3143 zsmooth : 'fast'
3244 } ;
3345 supplyDefaults ( traceIn , traceOut , '' , { } ) ;
3446 expect ( traceOut . zsmooth ) . toBe ( 'fast' ) ;
3547 } ) ;
3648
3749 it ( 'should set xgap and ygap to 0 when xgap and ygap are empty' , function ( ) {
38- traceIn = { } ;
50+ traceIn = { x : [ 1 , 2 ] , y : [ 1 , 2 ] } ;
3951 supplyDefaults ( traceIn , traceOut , '' , { } ) ;
4052 expect ( traceOut . xgap ) . toBe ( 0 ) ;
4153 expect ( traceOut . ygap ) . toBe ( 0 ) ;
4254 } ) ;
4355
4456 it ( 'shouldnt step on xgap and ygap when xgap and ygap are set' , function ( ) {
4557 traceIn = {
58+ x : [ 1 , 2 ] ,
59+ y : [ 1 , 2 ] ,
4660 xgap : 10 ,
4761 ygap : 5
4862 } ;
@@ -53,6 +67,8 @@ describe('Test histogram2d', function() {
5367
5468 it ( 'shouldnt coerce gap when zsmooth is set' , function ( ) {
5569 traceIn = {
70+ x : [ 1 , 2 ] ,
71+ y : [ 1 , 2 ] ,
5672 xgap : 10 ,
5773 ygap : 5 ,
5874 zsmooth : 'best'
0 commit comments