//**************************************************************************
//
//
// National Institute Of Standards and Technology
// DTS Version 1.0
//
// ProcessingInstruction Interface
//**************************************************************************
function ProcessingInstruction()
{
var tests = new Array (core0001P(), core0002P(), core0003P());
return tests;
}
//------------------------ test case core-0001P ------------------------
//
// Testing feature - The "target" attribute is the target of the
// processing instruction. It is the first token that
// follows the markup of the processing instruction.
//
// Testing approach - Retrieve the ProcessingInstruction node located
// inside the entity named "ent4" and access its
// "target" attribute. Its value should be "PItarget".
//
// Semantic Requirements: 1
//
// Last modification date - May 1, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0001P()
{
var computedValue = "";
var expectedValue = "PItarget"
var testNode = "";
var pINode = "";
results = new testResults("Core0001P");
results.description = "The \"target\" attribute is the target of this "+
"processing instruction. It is the first token "+
"token after the markup that begin the processing "+
"instruction.";
//
// Retrieve the targeted data and access its "target" attribute.
//
testNode = getEntity("ent4");
pINode = testNode.lastChild;
computedValue = pINode.target;
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0001P --------------------------
//
//--------------------------- test case core-0002P ---------------------------
//
// Testing feature - The "data" attribute is the content of the
// processing instruction. It starts at the first non
// white character following the target and ends at the
// character immediately preceding the "?>".
//
// Testing approach - Retrieve the ProcessingInstruction node located
// inside the entity named "ent4" and access its "data"
// attribute. Its value should be "PIdata".
//
// Semantic Requirements: 2
//
// Last modification date - May 1, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0002P()
{
var computedValue = "";
var expectedValue = "PIdata"
var testNode = "";
var pINode = "";
results = new testResults("Core0002P");
results.description = "The \"data\" attribute is the content of the "+
"processing instruction. It starts with the "+
"the first non white character following the target "+
"and ends with the character immediately preceding "+
"the \"?>\".";
//
// Retrieve the targeted data and access its "data" attribute.
//
testNode = getEntity("ent4");
pINode = testNode.lastChild;
computedValue = pINode.data;
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0002P --------------------------
//
//--------------------------- test case core-0003P ---------------------------
//
// Testing feature - The "data" attribute raises a NO_MODIFICATION_ALLOWED_ERR
// DOMEexception when the node is readonly.
//
// Testing approach - Retrieve the ProcessingInstruction node located
// inside the entity named "ent4" and attempt to set
// a new value for its "data" attribute. Since descendants
// of Entity nodes are readonly, the desired exception
// should be raised.
//
// Semantic Requirements: 3
//
// Last modification date - July 8, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0003P()
{
var computedValue = "";
var expectedValue = NO_MODIFICATION_ALLOWED_ERR;
var testNode = "";
var pINode = "";
results = new testResults("Core0003P");
results.description = "The \"data\" attribute raises a "+
"NO_MODIFICATION_ALLOWED_ERR DOMException "+
"when the node is readonly."
//
// Retrieve the targeted data.
//
testNode = getEntity("ent4");
pINode = testNode.lastChild;
//
// Attempt to modify a readonly node should raise an exception.
//
try {
pINode.data = "ABCD";
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0003P --------------------------