{error?.message}
+ resetError()} /> +{message}
+ case "4": + return ScriptElement(message); + default: + console.log(`unknown message type: ${messageType}`) + return <>>; + } + } + + switch (callback.type) { + case "NameCallback": + return setCallbackValue(e.target.value)} type="text" name={inputId} + value={callback.input[0].value} required={true} /> + case "PasswordCallback": + return setCallbackValue(e.target.value)} type="password" name={inputId} + value={callback.input[0].value} required={true} /> + case "TextOutputCallback": + return renderTextOutputCallback(callback) + default: + return null + } +} + + + +export default DefaultCallbackElement; \ No newline at end of file diff --git a/openam-ui/openam-ui-js-sdk/src/lib/components/DefaultErrorForm.test.tsx b/openam-ui/openam-ui-js-sdk/src/lib/components/DefaultErrorForm.test.tsx new file mode 100644 index 0000000000..b858d98e0a --- /dev/null +++ b/openam-ui/openam-ui-js-sdk/src/lib/components/DefaultErrorForm.test.tsx @@ -0,0 +1,44 @@ +/** + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions copyright [year] [name of copyright owner]". + * + * Copyright 2025 3A Systems LLC. + */ + +import { render, screen, fireEvent } from '@testing-library/react'; +import { vi, describe, it, expect } from 'vitest'; +import DefaultErrorForm from './DefaultErrorForm'; + + +describe('DefaultErrorForm', () => { + const mockResetError = vi.fn(); + + const defaultProps = { + error: { code: 401, reason: 'Test reason', message: 'Test error message'}, + resetError: mockResetError + } + + it('renders error message and retry button', () => { + render({error?.message}
+