Constructor
new Test(conf)
Quiz Tests Class
Constructor for creating "Test" objects. It supports a parameter with a configuration object with certain properties or attributes.
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | Configuration object (see |
- Source:
- See:
Members
className :string
clone from conf.className
if you wish a specific class name for container
Type:
- string
- Source:
conf :Object
Configuration Options
a Javascript object with follow structure:
{ className: "testron-80", container: "divUI", markerContainer: "divMarker", remove: true, markerRemove: true, digits: 4, precision: 2, nQ: 1, nA: 4, stopOnSuccess: false, charset: "utf-8" }
Type:
- Object
- Source:
container :Object:HTMLElement
clone from conf.container
the DOM element which embed the UI
Type:
- Object:HTMLElement
- Source:
element :Object:HTMLElement
own DOM element
Type:
- Object:HTMLElement
- Source:
markerContainer :Object:HTMLElement
clone from conf.markerContainer
similarly to 'container' for Marker (It advised in fixed position)
Type:
- Object:HTMLElement
- Source:
markerElement :Object:HTMLElement
DOM Element for own Marker
Type:
- Object:HTMLElement
- Source:
markerRemove :boolean
clone from conf.markerRemove
similarly to 'remove' for Marker
Type:
- boolean
- Source:
num :number
Number of this Test.
This is not equal to this.id (from 0 to +Infinity)
Type:
- number
- Source:
questions :Array:Question
Question objects array
Type:
- Array:Question
- Source:
remove :boolean
clone from conf.remove
cleans the container before insert the content
Type:
- boolean
- Source:
root :namespace:testron
"testron" Parent object
Type:
- namespace:testron
- Source:
Methods
addQuestion(question, refresh) → {Object:Question}
Adding a Question object to this Test
Parameters:
Name | Type | Description |
---|---|---|
question |
Object:testron.Test.Question | "Question" object |
refresh |
boolean | update this Test ? |
- Source:
Returns:
Return the same question input parameter
- Type
- Object:Question
checkFinished() → {boolean}
Checks if this Test is finished.
- Source:
Returns:
- Type
- boolean
createMarker(conf) → {Object:Marker}
Create a Marker object to this Test
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | Configuration object (for Marker Objects) |
- Source:
Returns:
Return the new Marker created
- Type
- Object:Marker
createQuestion(conf) → {Object:Question}
Create and adding a Question object to this Test
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | Configuration object (for Question Objects) |
- Source:
Returns:
Return the new Question created
- Type
- Object:Question
filterConf(conf) → {Object}
Filter the Configuration Options
The Configuration Options will set to default if not exists
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | Configuration object |
- Source:
- See:
Returns:
The sanitized configuration options
- Type
- Object
parseTestron(test) → {string}
Create Test from 'test' parameter.
The parameter can be a Javascript object or a JSON string object with follow structure:
testron: { conf: {...}, questions: [...] // an Array of questions. (see Test#parseQuestions(...)) }
Parameters:
Name | Type | Description |
---|---|---|
test |
Object | string | a Javascript object or a JSON string object |
- Source:
Returns:
a DEBUG string with info
- Type
- string
toHtml() → {HTMLElement:HTMLUlElement}
Create the HTML-UI for this test and return it as HTMLElement (HTMLUlElement)
- Source:
Returns:
- Type
- HTMLElement:HTMLUlElement
toJSON() → {string}
Parse this element to JSON
- Source:
Returns:
a JSON string which represents to this Test object
- Type
- string
update()
Updates this Test.
Also updates the answers and questions number and its marker
- Source:
update_nAnQ()
Updates the answers and questions number and its marker
- Source: