//************************************************************************** // // // National Institute Of Standards and Technology // DTS Version 1.0 // // CDATASection Interface //************************************************************************** var i = 2; function CDATASection() { var tests = new Array (core0001CD(), core0002CD()); return tests; } //------------------------ test case core-0001CD ------------------------ // // Testing feature - The DOMString attribute from the Text node holds the // data that is contained by the CDATASection. // // Testing approach - Retrieve the last CDATASection node located inside the // second child of the second employee and examine its // content. Since the CDATASection interface inherits // from the CharacterData interface (via the Text node), // the "data" attribute can be used to access the CDATA // content. // // Semantic Requirements: 1 // // Last modification date - April 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0001CD() { var computedValue = ""; var expectedValue = "This is an adjacent CDATASection with a reference to a tab &tab;" var testNode = ""; var CDATANode = ""; results = new testResults("Core0001CD"); results.description = "The DOMString attribute from the Text node holds the " + "data that is contained by the CDATA section."; // // Retrieve the targeted data. // testNode = new nodeObject(SECOND,SECOND); CDATANode = testNode.node.lastChild; computedValue = CDATANode.data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0001CD -------------------------- // //--------------------------- test case core-0002CD --------------------------- // // Testing feature - Adjacent CDATASection nodes can not be merged together // by use of the "normalize" method from the // Element interface. // // Testing approach - Retrieve the second child of the second employee and // invoke its "normalize" method. The Element under test // contains two CDATASection nodes that should not be // merged together by an invocation to "normalize()". // // Semantic Requirements: 2 // // Last modification date - April 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0002CD() { var computedValue = ""; var expectedValue = "This is a CDATASection with EntityReference number 2 &ent2; " + "This is an adjacent CDATASection with a reference to a tab &tab;" var testNode = ""; var CDATAList = ""; results = new testResults("Core0002CD"); results.description = "Adjacent CDATASection nodes can not be merged together " + "by use of the normalize method from the Element interface."; // // Retrieve the targeted data. // testNode = new nodeObject(SECOND,SECOND); testNode.node.normalize(); CDATAList = testNode.node.childNodes // // Each CDATASection node should still be a separate node. // computedValue += CDATAList.item(1).data+" "; computedValue += CDATAList.item(2).data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0002CD --------------------------