File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ describe('single variable', () => {
4747 } ) ;
4848
4949 it . todo ( 'should set `selected` if nothing is selected' ) ;
50+
51+ it ( 'should render objects as strings' , ( ) => {
52+ const variable = shallow ( < Variable { ...props } user = { { apiKey : { renderTo : 'string' } } } /> ) ;
53+
54+ expect ( variable . text ( ) ) . toBe ( JSON . stringify ( { renderTo : 'string' } ) ) ;
55+ } ) ;
5056} ) ;
5157
5258describe ( 'multiple variables' , ( ) => {
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ class Variable extends React.Component {
3333 // - uppercase key
3434 getValue ( ) {
3535 const { variable } = this . props ;
36- if ( this . props . user [ variable ] ) return this . props . user [ variable ] ;
36+ const value = this . props . user [ variable ] || this . getDefault ( ) ;
3737
38- return this . getDefault ( ) ;
38+ return typeof value === 'object' ? JSON . stringify ( value ) : value ;
3939 }
4040
4141 toggleVarDropdown ( ) {
You can’t perform that action at this time.
0 commit comments