@@ -81,21 +81,44 @@ describe('Section', () => {
81
81
expect ( wrapper . find ( Numeric ) . exists ( ) ) . toBe ( false ) ;
82
82
} ) ;
83
83
84
- it ( 'will render first menuPanel even with no visible attrs' , ( ) => {
84
+ it ( 'will render first menuPanel' , ( ) => {
85
+ const TraceSection = connectTraceToPlot ( Section ) ;
85
86
const wrapper = mount (
86
87
< TestEditor onUpdate = { jest . fn ( ) } { ...fixtures . scatter ( ) } >
87
- < Section name = "test-section" >
88
+ < TraceSection name = "test-section" traceIndex = { 0 } >
89
+ < Numeric attr = "opacity" traceIndex = { 0 } />
88
90
< MenuPanel show >
89
91
< Info > INFO</ Info >
90
92
</ MenuPanel >
91
93
< MenuPanel show >
92
94
< Info > MISINFORMATION</ Info >
93
95
</ MenuPanel >
94
- </ Section >
96
+ </ TraceSection >
95
97
</ TestEditor >
96
98
) . find ( '[name="test-section"]' ) ;
97
99
100
+ expect ( wrapper . find ( MenuPanel ) . length ) . toBe ( 1 ) ;
98
101
expect ( wrapper . find ( Info ) . length ) . toBe ( 1 ) ;
99
102
expect ( wrapper . find ( Info ) . text ( ) ) . toBe ( 'INFO' ) ;
100
103
} ) ;
104
+
105
+ it ( 'will hides even with MenuPanel when attrs not defined' , ( ) => {
106
+ const TraceSection = connectTraceToPlot ( Section ) ;
107
+ const wrapper = mount (
108
+ < TestEditor onUpdate = { jest . fn ( ) } { ...fixtures . scatter ( ) } >
109
+ < TraceSection name = "test-section" traceIndex = { 0 } >
110
+ < Numeric attr = "badattr" traceIndex = { 0 } />
111
+ < MenuPanel show >
112
+ < Info > INFO</ Info >
113
+ </ MenuPanel >
114
+ < MenuPanel show >
115
+ < Info > MISINFORMATION</ Info >
116
+ </ MenuPanel >
117
+ </ TraceSection >
118
+ </ TestEditor >
119
+ ) . find ( '[name="test-section"]' ) ;
120
+
121
+ expect ( wrapper . find ( MenuPanel ) . length ) . toBe ( 0 ) ;
122
+ expect ( wrapper . find ( Info ) . length ) . toBe ( 0 ) ;
123
+ } ) ;
101
124
} ) ;
0 commit comments