Class: Test

mathex. Test

Handles the test rendering and flow

new Test() → {Object}

Test - Test class

Source:
Returns:
mathex.Test instance
Type
Object

Methods

init(questions, options)

Initializes the Test instance

Parameters:
Name Type Description
questions Array Array of test question objects
options Object Options
Properties
Name Type Argument Default Description
steps Array The steps used for the rating, in asc order, check is made this way: if result <= step sup limit
rating Array Array of objects describing the rating of the steps previously defined. Each object has a message property (text to be shown) and a color property (text color)
widgets Boolean <optional>
false Whether or not to create the widgets @see mathex.Shared
Source:
Returns:
void
Example
 test.init([question1, question2, question3], {
   steps: [2, 7, 10],
   rating: [
     {message: 'very bad', color: 'red'},
     {message: 'quite good', color: 'yellow'},
     {message: 'meow', color: 'green'},
   ]
 });

nextQuestion()

Goes to the next questions or the end of the test

Source:
Returns:
void

renderResults()

Renders the test final rating

Source:
Returns:
void

saveResult()

Stores the given result

Source:
Returns:
void

start()

Executes the given index question

Source:
Returns:
void