Reporter.js revision 625ac94d269a4ae4992b98f0cb3d66a32f1d41d0
/**
* An object capable of sending test results to a server.
* @param {String} url The URL to submit the results to.
* @param {Function} format (Optiona) A function that outputs the results in a specific format.
* Default is Test.TestFormat.XML.
* @constructor
* @namespace Test
* @class Reporter
*/
/**
* The URL to submit the data to.
* @type String
* @property url
*/
/**
* The formatting function to call when submitting the data.
* @type Function
* @property format
*/
/**
* Extra fields to submit with the request.
* @type Object
* @property _fields
* @private
*/
this._fields = new Object();
/**
* The form element used to submit the results.
* @type HTMLFormElement
* @property _form
* @private
*/
this._form = null;
/**
* Iframe used as a target for form submission.
* @type HTMLIFrameElement
* @property _iframe
* @private
*/
this._iframe = null;
};
//restore missing constructor
/**
* Adds a field to the form that submits the results.
* @param {String} name The name of the field.
* @param {Variant} value The value of the field.
* @return {Void}
* @method addField
*/
},
/**
* Removes all previous defined fields.
* @return {Void}
* @method addField
*/
clearFields : function(){
this._fields = new Object();
},
/**
* Cleans up the memory associated with the TestReporter, removing DOM elements
* that were created.
* @return {Void}
* @method destroy
*/
destroy : function() {
if (this._form){
this._form = null;
}
if (this._iframe){
this._iframe = null;
}
this._fields = null;
},
/**
* Sends the report to the server.
* @param {Object} results The results object created by TestRunner.
* @return {Void}
* @method report
*/
//if the form hasn't been created yet, create it
if (!this._form){
//IE won't let you assign a name using the DOM, must do it the hacky way
try {
} catch (ex){
}
}
//set the form's action
//remove any existing fields
while(this._form.hasChildNodes()){
}
//create default fields
//add fields to the form
}
}
//remove default fields
if (arguments[1] !== false){
}
}
};