Namespace: testron

testron

This 'namespace' is the starting point for building tests of 'testrons' type. It contains the methods and objects necessary for even build all full UI.

Version:
  • 1.0.0b
Author:
  • GuerraTron - 2015. <dinertron@gmail.com> - GPL-v3
Source:

Examples

To create complete Test UI:

var tests = testron.parseTestrons(
                                  objJS, 
                                  {container: 'divUI', 
                                   markerContainer: 'divMarker'
                                  });

Using the events:

testron.onOk(function(answer, marker){
  alert("OK: " + 
        answer.parent.num + "[" + 
        answer.name + "] ). " + 
        marker.score);
  contMarker.style.visibility = "visible";
});
testron.onFinished(function(test){
  alert("FINISHED TEST: " + test.id);
});

Members

(private, static) alpha

Static Alphanumeric variable for "id" generated

Source:

(private, static) clickAnswerListener

Event Listener for clicks Answer. This must be a function with two parameters: Answer object and Marker object

Source:

(private, static) failAnswerListener

Event Listener for failed Answer. This must be a function with two parameters: Answer object and Marker object

Source:

(private, static) finishedListener

Event to Listener from finished Test. The listener passed must be a function with one parameter: Test object

Source:

(private, static) nextQuestionListener

Event to Listener from next Question. The listener passed must be a function with two parameters: Question object and Marker object

Source:

(private, static) prefImg64GIF

Static pref for Base64 images with 'monocrome GIF' format

Source:

(private, static) successAnswerListener

Event Listener for successed Answer. This must be a function with two parameters: Answer object and Marker object

Source:

(static) t.id :string

obtains this identificator

Type:
  • string
Source:

(static) t.utils :Object

The utils object

Type:
  • Object
Properties:
Name Type Description
generateId string

obtains a unique identificator

Util.toPrecision function

Obtains a number which is fixed to exact precision

Util.toDecimals function

Obtains a number which is fixed to concrete decimals

Util.toDigits function

Obtains a number which is fixed to exact digits

Util.icos Object

Is a object which contains icons on base64 format

Util.addEvent function

Cross-browser Method for adding events

Util.editListener function

Listener for shooting of change events (editArea).

Util.saveListener function

Listener for shooting of save events (button).

Util.copyClipboardListener function

Listener for shooting of copy events (clipboard).

Util.resetListener function

reset the listener for this object. (non-implementable currently)

Util.setTimerContainer function

set a timer for this container element

Source:

(private, static) tests

testrons array

Source:

(private, static) updateMarkerListener

Event to Listener from update Marker. The listener passed must be a function with one parameter: Marker object

Source:

Methods

(static) t.addTest()

Add a Test to array

Source:

(static) t.filterContainer() → {Object}

Filter the configuration object to sanitize

Source:
Returns:

the sanitized configuration object

Type
Object

(static) t.getTests() → {Array:tests}

Getter method

Source:
Returns:
Type
Array:tests

(static) t.merge() → {Object}

Method to merge the properties from two objects (configuration)

Source:
Returns:

the merged object

Type
Object

(static) t.parseTestrons() → {Array}

Parse a JSON string which represents the complete testron suite

Source:
Returns:

the updated tests array

Type
Array

(static) t.removeTest() → {Array}

Remove a Test from array

Source:
Returns:

the updated tests array

Type
Array

(static) t.removeTestIndex() → {Array}

Remove a Test from array, from its index

Source:
Returns:

the updated tests array

Type
Array

(static) t.resetTests()

Remove ALL Test from array

Source:

(static) t.toJSON() → {string}

Obtain a JSON string which represents the complete testron suite

Source:
Returns:

JSON string

Type
string

Events

t.onClick

Event to Listener from clicks Answer.

The listener passed must be a function with two parameters: Answer object and Marker object

Source:

t.onFail

Event to Listener from failed Answer.

The listener passed must be a function with two parameters: Answer object and Marker object

Source:

t.onFinished

Event to Listener from finished Test.

The listener passed must be a function with one parameter: Test object

Source:

t.onMarker

Event to Listener from update Marker.

The listener passed must be a function with one parameter: Marker object

Source:

t.onNext

Event to Listener from next Question.

The listener passed must be a function with two parameters: Question object and Marker object

Source:

t.onOk

Event to Listener from successed Answer.

The listener passed must be a function with two parameters: Answer object and Marker object

Source:

based on the 'Doctron template'   by
Δ