Class: TestInputQuestion

mathex. TestInputQuestion

new TestInputQuestion(options) → {Object}

Test - Test question, answers with only text fields

Parameters:
Name Type Argument Description
options Object <optional>
Options
Properties
Name Type Argument Description
question String <optional>
The question and answer template to be parsed.

The math to be parsed by mathjax (latex syntax) must be placed inside the tag {%%}, i.e. {% 2^4=16 %}

The input fields inside the math must be formatted this way: \\FormInput2, where 2 is the id of the input which is described through the inputs parameter.

inputs String <optional>
Object storing ll the inputs description. Each input object has the properties:
  • size: number. The input field size
  • result: string. The input field result
  • type: string. The input field result type ('float', 'int', 'string_case')
Source:
Returns:
mathex.TestInputQuestion instance
Type
Object
Example
 var question1 = new mathex.TestQuestion('input', {
   question: '<p>How do you write the pow with base 20 and exponent 3?</p><p>{%\\FormInput0 ^ \\FormInput1%}</p>',
   inputs: {
     0: {
       size: 2,
       result: '20',
       type: 'int'
     },
     1: {
       size: 1,
       result: 3,
       type: 'int'
     }
   }
 });

Methods

checkAnswer()

Cheks the user answer, saves the result and proceeds with the next question

Source:
Returns:
void

run(test)

Executes the test question

Parameters:
Name Type Description
test Object The mathex.Test instance
Source:
Returns:
void