Your record has the following errors:
+ +You must fix these errors before proceeding to save.
+ > + ) + } + actions={ + [ + { + label: 'Go Back', + variant: 'primary', + onClick: handleErrorsBack + } + ] + } + /> + > ) } +JsonPreview.defaultProps = { + schema: null +} + +JsonPreview.propTypes = { + // The full UMM schema (not a section-limited schema) to validate the + // edited JSON against on save. If omitted, only JSON-syntax validation + // is performed. + // eslint-disable-next-line react/forbid-prop-types + schema: PropTypes.object +} + export default JsonPreview diff --git a/static/src/js/components/JsonPreview/__tests__/JsonPreview.test.jsx b/static/src/js/components/JsonPreview/__tests__/JsonPreview.test.jsx index 72fc1e055..39fa2b5a0 100644 --- a/static/src/js/components/JsonPreview/__tests__/JsonPreview.test.jsx +++ b/static/src/js/components/JsonPreview/__tests__/JsonPreview.test.jsx @@ -1,5 +1,10 @@ import React from 'react' -import { render } from '@testing-library/react' +import { + render, + screen, + within +} from '@testing-library/react' +import userEvent from '@testing-library/user-event' import JSONPretty from 'react-json-pretty' import JsonPreview from '../JsonPreview' @@ -7,14 +12,125 @@ import AppContext from '../../../context/AppContext' vi.mock('react-json-pretty') -const setup = (draft = undefined) => { - render( -