mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Merge pull request #5705 from AlexSCorey/5599-VariableDetailsAbsent
Ensures Variables Details renders even when no value. Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
99ce277b06
@ -14,10 +14,6 @@ function VariablesDetail({ value, label, rows }) {
|
||||
const [currentValue, setCurrentValue] = useState(value);
|
||||
const [error, setError] = useState(null);
|
||||
|
||||
if (!value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<DetailName
|
||||
@ -62,7 +58,7 @@ function VariablesDetail({ value, label, rows }) {
|
||||
>
|
||||
<CodeMirrorInput
|
||||
mode={mode}
|
||||
value={currentValue}
|
||||
value={currentValue || '---'} // When github issue https://github.com/ansible/awx/issues/5502 gets resolved this line of code should be revisited and refactored if possible.
|
||||
readOnly
|
||||
rows={rows}
|
||||
css="margin-top: 10px"
|
||||
|
||||
@ -40,4 +40,9 @@ describe('<VariablesDetail>', () => {
|
||||
expect(input2.prop('mode')).toEqual('yaml');
|
||||
expect(input2.prop('value')).toEqual('foo: bar\n');
|
||||
});
|
||||
test('should render label and value= --- when there are no values', () => {
|
||||
const wrapper = shallow(<VariablesDetail value="" label="Variables" />);
|
||||
expect(wrapper.find('Styled(CodeMirrorInput)').length).toBe(1);
|
||||
expect(wrapper.find('div.pf-c-form__label').text()).toBe('Variables');
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user