mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Ensures Variables Details renders even when no value.
When there is no value VariablesDetails will show ---.
This commit is contained in:
parent
49d1fa82d3
commit
c45b1ffca6
@ -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