mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 20:30:46 -03:30
fix type errors in VariablesDetail
This commit is contained in:
parent
d6a5a1e0d0
commit
f867c9e476
@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef, useCallback } from 'react';
|
||||
import { oneOf, bool, number, string, func } from 'prop-types';
|
||||
import { oneOf, bool, number, string, func, oneOfType } from 'prop-types';
|
||||
import ReactAce from 'react-ace';
|
||||
import 'ace-builds/src-noconflict/mode-json';
|
||||
import 'ace-builds/src-noconflict/mode-javascript';
|
||||
@ -77,7 +77,7 @@ function CodeEditor({
|
||||
className,
|
||||
i18n,
|
||||
}) {
|
||||
if (typeof rows !== 'number' && rows !== 'auto') {
|
||||
if (rows && typeof rows !== 'number' && rows !== 'auto') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warning(
|
||||
`CodeEditor: Unexpected value for 'rows': ${rows}; expected number or 'auto'`
|
||||
@ -186,7 +186,7 @@ CodeEditor.propTypes = {
|
||||
readOnly: bool,
|
||||
hasErrors: bool,
|
||||
fullHeight: bool,
|
||||
rows: oneOf(number, string),
|
||||
rows: oneOfType([number, string]),
|
||||
className: string,
|
||||
};
|
||||
CodeEditor.defaultProps = {
|
||||
|
||||
@ -148,7 +148,7 @@ function VariablesDetail({ dataCy, helpText, value, label, rows, i18n }) {
|
||||
VariablesDetail.propTypes = {
|
||||
value: oneOfType([shape({}), arrayOf(string), string]).isRequired,
|
||||
label: node.isRequired,
|
||||
rows: oneOfType(number, string),
|
||||
rows: oneOfType([number, string]),
|
||||
dataCy: string,
|
||||
helpText: string,
|
||||
};
|
||||
|
||||
@ -32,7 +32,7 @@ describe('VariablesField', () => {
|
||||
</Formik>
|
||||
);
|
||||
const buttons = wrapper.find('Button');
|
||||
expect(buttons).toHaveLength(2);
|
||||
expect(buttons).toHaveLength(3);
|
||||
expect(buttons.at(0).prop('variant')).toEqual('primary');
|
||||
expect(buttons.at(1).prop('variant')).toEqual('secondary');
|
||||
await act(async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user