@@ -27,6 +27,24 @@ describe('TraceSelector', () => {
27
27
expect ( innerDropdown . prop ( 'value' ) ) . toEqual ( 'area' ) ;
28
28
} ) ;
29
29
30
+ it . only ( 'takes mode from fullData if not present in data, and recognizes trace correctly' , ( ) => {
31
+ const editorProps = {
32
+ ...fixtures . scatter ( { fullData : [ { mode : 'lines' } ] } ) ,
33
+ onUpdate : jest . fn ( ) ,
34
+ } ;
35
+ const wrapper = mount (
36
+ < TestEditor { ...editorProps } plotly = { plotly } >
37
+ < TraceSection traceIndex = { 0 } >
38
+ < TraceSelector attr = "type" />
39
+ </ TraceSection >
40
+ </ TestEditor >
41
+ ) . find ( TraceSelector ) ;
42
+
43
+ const innerDropdown = wrapper . find ( Dropdown ) ;
44
+
45
+ expect ( innerDropdown . prop ( 'value' ) ) . toEqual ( 'line' ) ;
46
+ } ) ;
47
+
30
48
it ( 'interprets scatter + mode=lines as type=line' , ( ) => {
31
49
const editorProps = {
32
50
...fixtures . scatter ( { data : [ { mode : 'lines' } ] } ) ,
@@ -81,7 +99,7 @@ describe('TraceSelector', () => {
81
99
const innerDropdown = wrapper . find ( Dropdown ) ;
82
100
innerDropdown . prop ( 'onChange' ) ( 'line' ) ;
83
101
84
- const payload = onUpdateTraces . mock . calls [ 1 ] [ 0 ] ;
102
+ const payload = onUpdateTraces . mock . calls [ 0 ] [ 0 ] ;
85
103
expect ( payload . update ) . toEqual ( {
86
104
fill : 'none' ,
87
105
mode : 'lines' ,
@@ -107,7 +125,7 @@ describe('TraceSelector', () => {
107
125
const innerDropdown = wrapper . find ( Dropdown ) ;
108
126
innerDropdown . prop ( 'onChange' ) ( 'area' ) ;
109
127
110
- const payload = onUpdateTraces . mock . calls [ 1 ] [ 0 ] ;
128
+ const payload = onUpdateTraces . mock . calls [ 0 ] [ 0 ] ;
111
129
expect ( payload . update ) . toEqual ( { fill : 'tozeroy' , type : 'scatter' } ) ;
112
130
} ) ;
113
131
} ) ;
0 commit comments