import { SimpleJSON } from "../core/util"; import { GraderSpecificationFor } from "../graders/QuestionGrader"; import { ResponseHandler, SubmissionType } from "./responses"; /** * ## Multiple Choice Response Element Specification * * An Multiple Choice response provides several options that students select from. It may * be configured to allow only one choice (rendered as radio buttons) or multiple choice * (rendered as checkboxes). * * The [[IFrameResponseSpecification]] type alias represents the information needed to specify an MC * response as part of a question. * * Here's an example of a question with an MC response. * * ![image](media://response-sample-mc.png) * * ```typescript * export const Question_Sample_MC : QuestionSpecification = { * question_id: "sample_mc", * points: 2, * mk_description: * ` * This is a sample question. Which of the following is NOT a heirloom variety of tomato plant? * `, * response: { * kind: "multiple_choice", * choices: [ * "Green Zebra", * "Better Boy", * "Black Krim", * "Mr. Stripey", * "Brandywine" * ], * multiple: false, * default_grader: new SimpleMCGrader(1) * } * } * ``` * * ### Single or Multiple Response * * If the `multiple` property is set to `false`, choices are rendered as radio buttons and * students may only select a single choice. If the property is set to `true`, choices are * rendered as checkboxes and students may select any number of choices. * * A multiple-selection MC question may specify a limit for the number of checkboxes * that may be selected via the `limit` property. (This property is ignored if multiple * selections are not allowed.) * * ### MC Submissions * * Essentially, a submission for an MC response is an array of numbers corresponding to the indices * of selected choices. See [[`IFrameSubmission`]] for details. */ export type IFrameResponseSpecification = { /** * The discriminant `"iframe"` is used to distinguish iframe response specifications. */ kind: "iframe"; /** * The relative src where the iframe .html may be found. For example, * if it is included as an exam-wide asset, it might be "assets/whatever.html". */ src: string; /** * A class (or space-separated list of classes) that will be set * on the iframe element. */ element_class?: string; /** * CSS styling to be applied to the iframe element. */ element_style?: string; /** * A sample solution, which may not be blank or invalid. */ sample_solution?: SubmissionType<"iframe">; /** * A default grader, used to evaluate submissions for this response. */ default_grader?: GraderSpecificationFor<"iframe">; }; export type IFrameSubmission = { _examma_ray_iframe_submission: void; } & SimpleJSON; export declare const IFRAME_HANDLER: ResponseHandler<"iframe">;