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