//**************************************************************************
//
//
// National Institute Of Standards and Technology
// DTS Version 1.1
//
// HTMLOptionElement Interface
//**************************************************************************
function HTMLOptionElement()
{
var tests = new Array (HTML0001HOPE(),HTML0002HOPE(),HTML0003HOPE(),HTML0004HOPE(),HTML0005HOPE(),HTML0006HOPE(),HTML0007HOPE(),HTML0008HOPE(),HTML0009HOPE());
return tests;
}
//------------------------ test case HTML-0001HOPE -------------------------
//
// Testing feature - The "form" attribute specifies the FORM element
// containing this control.
//
// Testing approach - Retrieve the "form" attribute from the first
// OPTION element of the testing document and examine
// the "name" attribute of the returned FORM element.
// It should be equal to "form1".
//
// Semantic Requirements: 1
//
// Last modification date - November 1, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0001HOPE()
{
var computedValue = "";
var expectedValue = "FORM1";
var results = "";
var testNode = "";
var formName = "";
results = new testResults("HTML0001HOPE");
results.description = "The \"form\" attribute specifies the FORM "+
"element containing this control.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,FIRST);
//
// and access its "form" attribute.
//
formName = testNode.node.form.id;
computedValue = formName.toUpperCase();
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0001HOPE -------------------------
//
//------------------------ test case HTML-0002HOPE -------------------------
//
// Testing feature - The "form" attribute returns null if this control is not
// within the context of a form.
//
// Testing approach - Retrieve the "form" attribute from the eleventh
// OPTION element of the testing document and examine
// its value. It should be equal to null.
//
// Semantic Requirements: 2
//
// Last modification date - October 25, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0002HOPE()
{
var computedValue = "";
var expectedValue = null;
var results = "";
var testNode = "";
results = new testResults("HTML0002HOPE");
results.description = "The \"form\" attribute returns null if this "+
"control is not within the context of a form.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,ELEVENTH);
//
// and access its "form" attribute.
//
computedValue = testNode.node.form;
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0002HOPE -------------------------
//
//------------------------ test case HTML-0003HOPE -------------------------
//
// Testing feature - The "defaultSelected" attribute contains the value of the
// of the selected attribute.
//
// Testing approach - Retrieve the "defaultSelected" attribute from the first
// OPTION element of the testing document and examine
// its value. It should be equal to true.
//
// Semantic Requirements: 3
//
// Last modification date - August 30, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0003HOPE()
{
var computedValue = "";
var expectedValue = true;
var results = "";
var testNode = "";
results = new testResults("HTML0003HOPE");
results.description = "The \"defaultSelected\" attribute contains "+
" the value of the selected attribute.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,FIRST);
//
// and access its "defaultSelected" attribute.
//
computedValue = testNode.node.defaultSelected;
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0003HOPE -------------------------
//
//------------------------ test case HTML-0004HOPE -------------------------
//
// Testing feature - The "text" attribute contains the text contained
// within this option element.
//
// Testing approach - Retrieve the "text" attribute from the second
// OPTION element of the testing document and examine
// its value. It should be equal to "EMP0002".
//
// Semantic Requirements: 4
//
// Last modification date - August 30, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0004HOPE()
{
var computedValue = "";
var expectedValue = "EMP0002";
var results = "";
var testNode = "";
results = new testResults("HTML0004HOPE");
results.description = "The \"text\" attribute contains the "+
"text contained within the option "+
"element.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,SECOND);
//
// and access its "text" attribute.
//
computedValue = testNode.node.text;
computedValue = computedValue.toUpperCase();
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0004HOPE -------------------------
//
//------------------------ test case HTML-0005HOPE -------------------------
//
// Testing feature - The "index" attribute indicates the index of this
// OPTION in its parent SELECT.
//
// Testing approach - Retrieve the "index" attribute from the seventh
// OPTION element of the testing document and examine
// its value. It should be equal to 1 as this is the
// second (counting from 0) OPTION element within the
// second SELECT.
//
// Semantic Requirements: 5
//
// Last modification date - August 30, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0005HOPE()
{
var computedValue = "";
var expectedValue = SECOND;
var results = "";
var testNode = "";
results = new testResults("HTML0005HOPE");
results.description = "The \"index\" attribute indicates "+
"the index of this OPTION in its parent "+
"SELECT.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,SEVENTH);
//
// and access its "index" attribute.
//
computedValue = testNode.node.index;
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0005HOPE -------------------------
//
//------------------------ test case HTML-0006HOPE -------------------------
//
// Testing feature - The "disabled" attribute indicates that this control is
// not available within this context.
//
// Testing approach - Retrieve the "disabled" attribute from the twelveth
// OPTION element of the testing document and examine
// its value. It should be equal to true.
//
// Semantic Requirements: 6
//
// Last modification date - October 25, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0006HOPE()
{
var computedValue = "";
var expectedValue = true;
var results = "";
var testNode = "";
results = new testResults("HTML0006HOPE");
results.description = "The \"disabled\" attribute indicates "+
"that this control is unavailable in "+
"this content.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,TWELVETH);
//
//
// and access "disabled" attribute.
//
computedValue = testNode.node.disabled;
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0006HOPE -------------------------
//
//------------------------ test case HTML-0007HOPE -------------------------
//
// Testing feature - The "label" attribute is used in hierarchichal menus. It
// specifies a shorter label for an option than the content
// of the OPTION element.
//
// Testing approach - Retrieve the "label" attribute from the thirdteenth
// OPTION element of the testing document and examine
// its value. It should be equal to "EMP0003".
//
// Semantic Requirements: 7
//
// Last modification date - October 25, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0007HOPE()
{
var computedValue = "";
var expectedValue = "EMP0003";
var results = "";
var testNode = "";
results = new testResults("HTML0007HOPE");
results.description = "The \"label\" attribute indicates "+
"a shorter label for an option than the "+
"content of the OPTION element.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,THIRDTEENTH);
//
//
// and access "label" attribute.
//
computedValue = testNode.node.label;
computedValue= computedValue.toUpperCase();
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0007HOPE -------------------------
//
//------------------------ test case HTML-0008HOPE -------------------------
//
// Testing feature - The "selected" attribute indicates the current state of the
// corresponding form control in an interactive user-agent.
//
// Testing approach - Retrieve the "selected" attribute from the fourth
// OPTION element of the testing document and examine
// its value. It should be equal to true.
//
// Semantic Requirements: 8
//
// Last modification date - August 30, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0008HOPE()
{
var computedValue = "";
var expectedValue = true;
var results = "";
var testNode = "";
results = new testResults("HTML0008HOPE");
results.description = "The \"selected\" attribute indicates "+
" current state of the corresponding form "+
" control in an interactive user-agent.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,FIRST);
//
//
// and access "selected" attribute.
//
computedValue = testNode.node.selected;
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0008HOPE -------------------------
//
//------------------------ test case HTML-0009HOPE -------------------------
//
// Testing feature - The "value" attribute contains the current form control
// value.
//
// Testing approach - Retrieve the "value" attribute from the first
// OPTION element of the testing document and examine
// its value. It should be equal to "EMP0001".
//
// Semantic Requirements: 9
//
// Last modification date - August 30, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function HTML0009HOPE()
{
var computedValue = "";
var expectedValue = "EMP0001";
var results = "";
var testNode = "";
results = new testResults("HTML0009HOPE");
results.description = "The \"value\" attribute contains "+
"the current form control value.";
//
// Retrieve targeted data.
//
testNode = new HTMLNodeObject(OPTION,FIRST);
//
//
// and access "value" attribute.
//
computedValue = testNode.node.value;
computedValue = computedValue.toUpperCase();
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case HTML-0009HOPE -------------------------