File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
packages/vanilla-renderers/test/renderers Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,30 @@ describe('OneOfEnum cell', () => {
171
171
expect ( select . options . item ( 1 ) . value ) . toBe ( 'b' ) ;
172
172
} ) ;
173
173
174
+ test ( 'render with empty option due to wrong hideEmptyOption value' , ( ) => {
175
+ const core = initCore ( fixture . schema , fixture . uischema , fixture . data ) ;
176
+ wrapper = mount (
177
+ < JsonFormsStateProvider initState = { { core } } >
178
+ < OneOfEnumCell
179
+ schema = { fixture . schema }
180
+ uischema = { {
181
+ ...fixture . uischema ,
182
+ options : { hideEmptyOption : 'true' } ,
183
+ } }
184
+ path = 'foo'
185
+ />
186
+ </ JsonFormsStateProvider >
187
+ ) ;
188
+
189
+ const select = wrapper . find ( 'select' ) . getDOMNode ( ) as HTMLSelectElement ;
190
+ expect ( select . tagName ) . toBe ( 'SELECT' ) ;
191
+ expect ( select . value ) . toBe ( 'a' ) ;
192
+ expect ( select . options ) . toHaveLength ( 3 ) ;
193
+ expect ( select . options . item ( 0 ) . value ) . toBe ( '' ) ;
194
+ expect ( select . options . item ( 1 ) . value ) . toBe ( 'a' ) ;
195
+ expect ( select . options . item ( 2 ) . value ) . toBe ( 'b' ) ;
196
+ } ) ;
197
+
174
198
test ( 'has classes set' , ( ) => {
175
199
const core = initCore ( fixture . schema , fixture . uischema , fixture . data ) ;
176
200
wrapper = mount (
You can’t perform that action at this time.
0 commit comments