import * as React from "react"; import type { MockWidgetOptions } from "./mock-widget-types"; import type { WidgetProps, Widget } from "../../types"; import type { MockWidgetPromptJSON } from "../../widget-ai-utils/mock-widget/prompt-utils"; import type { PerseusMockWidgetUserInput } from "@khanacademy/perseus-score"; type ExternalProps = WidgetProps; type Props = ExternalProps; type DefaultProps = { userInput: Props["userInput"]; }; /** * This is a Mock Perseus widget, which is used for our various rendering tests * both internally and in consuming projects. It is a simple widget that renders * an interactable input field, and allows the user to input a string value. * * Please use this widget for all tests that are not specifically testing the * functionality of a particular widget, such as testing the rendering components. * This allows us to more easily update our widget schemas and behaviour without needing to * update many different irrelevant tests across our codebases. * * You can register this widget for your tests by calling `registerWidget("mock-widget", MockWidget);` */ declare class MockWidgetComponent extends React.Component implements Widget { static defaultProps: DefaultProps; inputRef: HTMLElement | null; getPromptJSON(): MockWidgetPromptJSON; focus: () => boolean; focusInputPath: () => void; blurInputPath: () => void; getInputPaths: () => ReadonlyArray>; handleChange: (newValue: string, cb?: () => unknown | null | undefined) => void; /** * @deprecated and likely very broken API * [LEMS-3185] do not trust serializedState */ getSerializedState(): { currentValue: string; static: boolean; value: string; trackInteraction: (extraData?: Empty | undefined) => void; widgetId: string; widgetIndex: number; alignment: string | null | undefined; problemNum: number | null | undefined; apiOptions: Readonly unknown; showAlignmentOptions?: boolean; readOnly?: boolean; editingDisabled?: boolean; answerableCallback?: (arg1: boolean) => unknown; getAnotherHint?: () => unknown; interactionCallback?: (widgetData: { [widgetId: string]: any; }) => void; imagePlaceholder?: React.ReactNode; widgetPlaceholder?: React.ReactNode; baseElements?: { Link: React.ComponentType; }; imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode; trackInteraction?: (args: { type: string; id: string; correct?: boolean; } & Partial & Partial<{ visible: number; }>) => void; customKeypad?: boolean; nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI; isMobile?: boolean; isMobileApp?: boolean; setDrawingAreaAvailable?: (arg1: boolean) => unknown; hintProgressColor?: string; canScrollPage?: boolean; editorChangeDelay?: number; flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale", boolean>; }> & { baseElements: NonNullable; canScrollPage: NonNullable; editorChangeDelay: NonNullable; isArticle: NonNullable; isMobile: NonNullable; isMobileApp: NonNullable; editingDisabled: NonNullable; onFocusChange: NonNullable; readOnly: NonNullable; setDrawingAreaAvailable: NonNullable; showAlignmentOptions: NonNullable; }>; keypadElement?: any; questionCompleted?: boolean; onFocus: (blurPath: import("../..").FocusPath) => void; onBlur: (blurPath: import("../..").FocusPath) => void; findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray; reviewMode: boolean; showSolutions?: import("@khanacademy/perseus-core").ShowSolutions; handleUserInput: (newUserInput: PerseusMockWidgetUserInput, cb?: () => void, silent?: boolean) => void; linterContext: import("@khanacademy/perseus-linter").LinterContextProps; containerSizeClass: import("../../util/sizing-utils").SizeClass; }; render(): React.ReactNode; } /** * @deprecated and likely a very broken API * [LEMS-3185] do not trust serializedState */ declare function getUserInputFromSerializedState(serializedState: any): PerseusMockWidgetUserInput; declare function getStartUserInput(options: PerseusMockWidgetUserInput): { currentValue: string; }; declare const _default: { name: string; displayName: string; widget: typeof MockWidgetComponent; isLintable: true; getStartUserInput: typeof getStartUserInput; getUserInputFromSerializedState: typeof getUserInputFromSerializedState; }; export default _default;