//************************************************************************** // // // National Institute Of Standards and Technology // DTS Version 1.0 // // NamedNodeMap Interface //************************************************************************** var i = 2; function NamedNodeMap() { var tests = new Array (core0001M(), core0002M(), core0003M(),core0004M(), core0005M(), core0006M(), core0007M(), core0008M(), core0009M(), core0010M(), core0011M(), core0014M(), core0015M(), core0016M(), core0017M(), core0018M(), core0019M(), core0020M(), core0021M()); return tests; } //------------------------ test case core-0001M ------------------------ // // Testing feature - The "getNamedItem(name)" method retrieves a node // specified by name. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // listing of the attributes of its last child. Once // the list is created an invocation of the // "getNamedItem(name)" method is done where // name = "domestic". This should result on the domestic // Attr node being returned. // // Semantic Requirements: 1 // // Last modification date - March 8, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0001M() { var computedValue = ""; var expectedValue = "domestic"; var domesticAttr = ""; var testNode = ""; results = new testResults("Core0001M"); results.description = "The \"getNamedItem(name)\" method retrieves a node " + "specified by name."; // // Retrieve targeted data. // testNode = new nodeObject(SECOND,SIXTH); domesticAttr = testNode.attributes.getNamedItem("domestic"); computedValue = domesticAttr.nodeName; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0001M -------------------------- // //--------------------------- test case core-0002M --------------------------- // // Testing feature - The "getNamedItem(name)" method returns a node of any // type specified by name. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // listing of the attributes of its last child. Once // the list is created an invocation of the // "getNamedItem(name)" method is done where // name = "street". This should cause the method to return // an Attr node. // // Semantic Requirements: 2 // // Last modification date - March 8, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0002M() { var computedValue = ""; var expectedValue = "street"; var streetAttr = ""; var testNode = ""; results = new testResults("Core0002M"); results.description = "The \"getNamedItem(name)\" method returns a node "+ "of any type specified by name (test for Attr node)."; // // Retrieve targeted data and get its attributes. // testNode = new nodeObject(SECOND,SIXTH); streetAttr = testNode.attributes.getNamedItem("street"); computedValue = streetAttr.name; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0002M -------------------------- // //--------------------------- test case core-0003M --------------------------- // // Testing feature - The "getNamedItem(name)" method returns null if the // specified name did not identify any node in the map. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // listing of the attributes of its last child. Once // the list is created an invocation of the // "getNamedItem(name)" method is done where // name = "district", this name does not match any names // in the list and the method should return null. // // Semantic Requirements: 3 // // Last modification date - March 8, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0003M() { var computedValue = ""; var expectedValue = null; var testNode = ""; results = new testResults("Core0003M"); results.description = "The \"getNamedItem(name)\" method returns null if the " + "specified name did not identify any node in the map."; // // Retrieve targeted data and attempt to get a non-existing attribute. // testNode = new nodeObject(SECOND,SIXTH); computedValue = testNode.attributes.getNamedItem("district"); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0003M -------------------------- // //--------------------------- test case core-0004M --------------------------- // // Testing feature - The "setNamedItem(arg)" method adds a node using its // nodeName attribute. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // object from the attributes in its last child // by invoking the "attributes" attribute. Once the // list is created, the "setNamedItem(arg)" method is // invoked with arg = newAttr, where newAttr is a new // Attr Node previously created. The "setNamedItem(arg)" // method should add the new node to the NamedNodeItem // object by using its "nodeName" attribute ("district" // in this case). Further this node is retrieved by using // the "getNamedItem(name)" method. This test uses the // "createAttribute(name)" method from the Document // interface. // // Semantic Requirements: 4 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0004M() { var computedValue = ""; var expectedValue = "district"; var districtAttr = ""; var newAttr = createNode(ATTRIBUTE_NODE,"district"); var testNode = ""; results = new testResults("Core0004M"); results.description = "The \"setNamedItem(arg)\" method adds a node "+ "using its nodeName attribute."; // // Retrieve targeted data and add new attribute. // testNode = new nodeObject(SECOND,SIXTH); testNode.attributes.setNamedItem(newAttr); districtAttr = testNode.attributes.getNamedItem("district") computedValue = districtAttr.nodeName; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0004M -------------------------- // //--------------------------- test case core-0005 --------------------------- // // Testing feature - If the node to be added by the "setNamedItem(arg)" method // already exists in the NamedNodeMap, it is replaced by the // new one. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // object from the attributes in its last child. Once // the list is created, the "setNamedItem(arg) method is // invoked with arg = newAttr, where newAttr is a Node Attr // previously created and whose node name already exist // in the map. The "setNamedItem(arg)" method should // replace the already existing node with the new one. // Further this node is retrieved by using the // "getNamedItem(name)" method. This test uses the // "createAttribute(name)" method from the Document // interface. // // Semantic Requirements: 5 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0005M() { var computedValue = ""; var expectedValue = ""; var streetAttr = ""; var newAttr = createNode(ATTRIBUTE_NODE,"street"); var testNode = ""; results = new testResults("Core0005M"); results.description = "If the node to be replaced by the \"setNamedItem(arg)\" " + "method is already in the list, the existing node should " + "be replaced by the new one."; // // Retrieve targeted data and add new attribute with name matching an // already existing attribute. // testNode = new nodeObject(SECOND,SIXTH); testNode.attributes.setNamedItem(newAttr); streetAttr = testNode.attributes.getNamedItem("street") computedValue = streetAttr.nodeValue; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0005M -------------------------- // //--------------------------- test case core-0006 --------------------------- // // Testing feature - If the "setNamedItem(arg)" method replaces an already // existing node with the same name then the already existing // node is returned. // // Testing approach - Retrieve the third employee and create a "NamedNodeMap" // object of the attributes in its last child by // invoking the "attributes" attribute. Once the // list is created, the "setNamedItem(arg) method is // invoked with arg = newAttr, where newAttr is a Node Attr // previously created and whose node name already exist // in the map. The "setNamedItem(arg)" method should replace // the already existing node with the new one and return // the existing node. Further this node is retrieved by // using the "getNamedItem(name)" method. This test // uses the "createAttribute(name)" method from the Document // interface. // // Semantic Requirements: 6 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0006M() { var computedValue = ""; var expectedValue = "No"; var returnedNode = ""; var newAttr = createNode(ATTRIBUTE_NODE,"street"); var testNode = ""; results = new testResults("Core0006M"); results.description = "If the \"setNamedItem(arg)\" method replaces an "+ "already existing node with the same name then it "+ "returns the already existing node."; // // Retrieve targeted data and examine value returned by the setNamedItem // method. // testNode = new nodeObject(THIRD,SIXTH); returnedNode = testNode.attributes.setNamedItem(newAttr); computedValue = returnedNode.nodeValue; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0006M -------------------------- // //--------------------------- test case core-0007 --------------------------- // // Testing feature - If the "setNamedItem(arg)" method does not replace an // already existing node with the same name then it // returns null. // // Testing approach - Retrieve the third employee and create a NamedNodeMap // object from the attributes in its last child. // Once the list is created, the "setNamedItem(arg)" // method is invoked with arg = newAttr, where newAttr is // a new previously created Attr node The // "setNamedItem(arg)" method should add the new node // and return null. Further this node is retrieved by // using the "getNamedItem(name)" method. This test // uses the "createAttribute(name)" method from the // Document interface. // // Semantic Requirements: 7 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0007M() { var computedValue = ""; var expectedValue = null; var newAttr = createNode(ATTRIBUTE_NODE,"district"); var testNode = ""; results = new testResults("Core0007M"); results.description = "If the \"setNamedItem(arg)\" method does not replace an "+ "already existing node then it returns null."; // // Retrieve targeted data and set new attribute. // testNode = new nodeObject(THIRD,SIXTH); computedValue = testNode.attributes.setNamedItem(newAttr); // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0007M -------------------------- // //--------------------------- test case core-0008 ---------------------------- // // Testing feature - The "removeNamedItem(name)" method removes a node // specified by name. // // Testing approach - Retrieve the third employee and create a NamedNodeMap // object from the attributes in its last child. Once // the list is created, the "removeNamedItem(name)" // method is invoked where "name" is the name of an // existing attribute. The "removeNamedItem(name)" method // should remove the specified attribute and its "specified" // attribute (since this is an Attr node) should be set // to false. // // Semantic Requirements: 8 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0008M() { var computedValue = ""; expectedValue = false; var testNode = ""; results = new testResults("Core0008M"); results.description = "The \"removedNamedItem(name)\" method removes "+ "a node specified by name."; // // Retrive targeted data and and remove attribute. It should no longer // be specified. // testNode = new nodeObject(THIRD,SIXTH); testNode.attributes.removeNamedItem("street"); computedValue = testNode.attributes.getNamedItem("street").specified; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0008M -------------------------- // //--------------------------- test case core-0009 ---------------------------- // // Testing feature - If the node removed by the "removeNamedItem(name)" method // is an Attr node with a default value, its is immediately // replaced. // // Testing approach - Retrieve the third employee and create a NamedNodeMap // object from the attributes in its last child. Once // the list is created, the "removeNamedItem(name)" method // is invoked where "name" is the name of an existing // attribute ("street)". The "removeNamedItem(name)" method // should remove the "street" attribute and since it has // a default value of "Yes", that value should immediately // be the attribute's value. // // Semantic Requirements: 9 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0009M() { var computedValue = ""; var expectedValue = "Yes"; var testNode = ""; results = new testResults("Core0009M"); results.description = "If the node removed by the \"removedNamedItem(name)\" "+ "method is an Attr node with a default value, then "+ "it is immediately replaced."; // // Retrieve targeted data and remove attribute. // testNode = new nodeObject(THIRD,SIXTH); testNode.attributes.removeNamedItem("street"); computedValue = testNode.attributes.getNamedItem("street").value; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0009M -------------------------- // //--------------------------- test case core-0010M --------------------------- // // Testing feature - The "removeNamedItem(name)" method returns the node removed // from the map. // // Testing approach - Retrieve the third employee and create a NamedNodeMap // object from the attributes in its last child. // Once the list is created, the "removeNamedItem(name)" // method is invoked where "name" is the name of an existing // attribute ("street)". The "removeNamedItem(name)" // method should remove the existing "street" attribute // and return it. // // Semantic Requirements: 10 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0010M() { var computedValue = ""; var expectedValue = "No"; var returnedNode = ""; var testNode = ""; results = new testResults("Core0010M"); results.description = "The \"removedNamedItem(name)\" method returns the "+ "node removed from the map."; // // Retrieve targeted data, remove attribute and examine returned value of // removeNamedItem method. // testNode = new nodeObject(THIRD,SIXTH); returnedNode = testNode.attributes.removeNamedItem("street"); computedValue = returnedNode.value; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0010M -------------------------- // //--------------------------- test case core-0011M --------------------------- // // Testing feature - The "removeNamedItem(name)" method returns null if the // name specified does not exists in the map. // // Testing approach - Retrieve the third employee and create a NamedNodeMap // object from the attributes in its last child. // Once the list is created, the "removeNamedItem(name)" // method is invoked where "name" does not exist in the // map. The method should return null. // // Semantic Requirements: 11 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0011M() { var computedValue = ""; var expectedValue = null; var testNode = "" results = new testResults("Core0011M"); results.description = "The \"removedNamedItem(name)\" method returns null "+ "if the specified \"name\" is not in the map."; // // Retrieve targeted data and attempt to remove a non-existing attribute. // testNode = new nodeObject(THIRD,SIXTH); computedValue = testNode.attributes.removeNamedItem("district"); // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0011M -------------------------- // //--------------------------- test case core-0012M --------------------------- // // Testing feature - The "item(index)" method returns the indexth item in the // map (test for first item). // // Testing approach - Retrieve the second employee and create a NamedNodeMap // object from the attributes in its last child by // by invoking the "attributes" attribute. Once // the list is created, the "item(index)" method is // invoked with index = 0. This should return the node at // the first position. Since there are no guarantees that // first item in the map is the one that was listed first // in the attribute list the test checks for all of them. // // Semantic Requirements: 12 // // Last modification date - March 9, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0012M() { var testName = "core-0012M"; var computedValue = ""; var expectedValue = "domestic or street"; var returnedNode = ""; var testNode = ""; results = new testResults("Core0012M"); results.description = "Retrieve the first item in the map via the \"item(index)\" method."; // // Retrieve targeted data and invoke "item" method. // testNode = new nodeObject(SECOND,SIXTH); returnedNode = testNode.attributes.item(0); computedValue = returnedNode.nodeName; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0012M -------------------------- // //--------------------------- test case core-0013M --------------------------- // // Testing feature - The "item(index)" method returns the indexth item in the // map (test for last item). // // Testing approach - Retrieve the second employee and create a NamedNodeMap // object from the attributes in its last child. // Once the list is created, the "item(index)" method is // invoked with index = 1. This should return the node at // the last position. Since there are no guarantees that // the last item in the map is the one that was listed last // in the attribute list, the test checks for all of them. // // Semantic Requirements: 12 // // Last modification date - March 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0013M() { var computedValue = ""; var expectedValue = "domestic or street"; var returnedNode = ""; var testNode = ""; results = new testResults("Core0013M"); results.description = "Retrieve the last item in the map via the \"item(index)\" method."; // // Retrieve targeted data and invoke "item" attribute. // testNode = new nodeObject(THIRD,SIXTH); returnedNode = testNode.attributes.item(1); computedValue = returnedNode.nodeName; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0013M -------------------------- // //--------------------------- test case core-0014M --------------------------- // // Testing feature - The "item(index)" method returns null if the index is // greater than the number of nodes in the map. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // object from the attributes in its last child. // element by invoking the "attributes" attribute. Once // the list is created, the "item(index)" method is // invoked with index = 3. This index value is greater than // the number of nodes in the map and under that condition // the method should return null. // // Semantic Requirements: 13 // // Last modification date - March 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0014M() { var computedValue = ""; var expectedValue = null; var testNode = ""; results = new testResults("Core0014M"); results.description = "The \"item(index)\" method returns null if the index "+ "index is greater than the number of nodes in the map."; // // Retrieve targeted data and invoke "item" method. // testNode = new nodeObject(THIRD,SIXTH); computedValue = testNode.attributes.item(3); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0014M -------------------------- // //--------------------------- test case core-0015M --------------------------- // // Testing feature - The "item(index)" method returns null if the index is // equal to the number of nodes in the map. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // object from the attributes in its last child // Once the list is created, the "item(index)" method is // invoked with index = 2. This index value is equal to // the number of nodes in the map and under that condition // the method should return null (first item is at position // 0). // // Semantic Requirements: 13 // // Last modification date - March 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0015M() { var computedValue = ""; var expectedValue = null; var testNode = ""; results = new testResults("Core0015M"); results.description = "The \"item(index)\" method returns null if the index " + "is equal to the number of nodes in the map."; // // Retrieve targeted data and invoke "item" method. // testNode = new nodeObject(THIRD,SIXTH); computedValue = testNode.attributes.item(2); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0015M -------------------------- // //--------------------------- test case core-0016M --------------------------- // // Testing feature - The "length" attribute contains the total number of // nodes in the map. // // Testing approach - Retrieve the second employee and create a NamedNodeMap // object from the attributes in its last child. // Once the list is created, the "length" attribute is // invoked. That attribute should contain the number 2. // // Semantic Requirements: 14 // // Last modification date - March 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0016M() { var computedValue = ""; var expectedValue = 2; var testNode = ""; results = new testResults("Core0016M"); results.description = "The \"length\" attribute contains the number of " + "nodes in the map."; // // Retrieve targeted data and invoke "length" attribute. // testNode = new nodeObject(THIRD,SIXTH); computedValue = testNode.attributes.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0016M -------------------------- // //--------------------------- test case core-0017M --------------------------- // // Testing feature - The range of valid child nodes indices is 0 to length - 1. // // Testing approach - Create a NamedNodeMap object from the attributes of the // last child of the third employee and traverse the // list from index 0 to index length - 1. All indices // should be valid. // // Semantic Requirements: 15 // // Last modification date - March 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0017M() { var computedValue = ""; expectedValue = "0 1 "; var lastIndex = 0; var attributes = ""; var testNode = ""; results = new testResults("Core0017M"); results.description = "The range of valid child nodes indices is 0 to " + "length - 1."; // // Retrieve targeted data and compute list length. // testNode = new nodeObject(THIRD,SIXTH); lastIndex = testNode.attributes.length - 1; // // Traverse the list from 0 to length - 1. All indices should be valid. // for (var index = 0;index <= lastIndex; index++) computedValue += index+" "; // // Write out results. // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0017M -------------------------- // //--------------------------- test case core-0018M --------------------------- // // Testing feature - The "setNamedItem(arg) method raises a WRONG_DOCUMENT_ERR // DOMException if "arg" was created from a different // document than the one that created the NamedNodeMap. // // Testing approach - Create a NamedNodeMap object from the attributes of the // last child of the third employee and attempt to // add another Attr node to it that was created from a // different DOM document. This condition should raise // the desired exception. This method uses the // "createAttribute(name)" method from the Document // interface. // // Semantic Requirements: 16 // // Last modification date - March 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0018M() { var computedValue = ""; var thirdEmpList = ""; var newAttrNode = getOtherDOMDocument().createAttribute("newAttribute"); var testNode = ""; var expectedValue = WRONG_DOCUMENT_ERR; results = new testResults("Core0018M"); results.description = "The \"setNamedItem(arg)\" method raises a "+ "WRONG_DOCUMENT_ERR DOMException if \"arg\" was " + "created from a document different from the one that created "+ "the NamedNodeList."; // // Retrieve targeted data and attempt to add an element that was created // from a different document. Should raise an exception. // testNode = new nodeObject(THIRD,SIXTH); try { testNode.attributes.setNamedItem(newAttrNode); } catch(DOMException) { computedValue = DOMException.code; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0018M -------------------------- // //--------------------------- test case core-0019M --------------------------- // // Testing feature - The "setNamedItem(arg) method raises a // NO_MODIFICATION_ALLOWED_ERR DOMException if this // NamedNodeMap is readonly. // // Testing approach - Create a NamedNodeMap object from the first child of the // Entity named "ent4" inside the DocType node and then // attempt to add a new item to the list. It should raise // the desired exception as this is a readonly NamedNodeMap. // // Semantic Requirements: 17 // // Last modification date - April 6, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0019M() { var computedValue = ""; var testNode; var entityDesc; var newAttrNode = createNode(ATTRIBUTE_NODE,"newAttribute"); var expectedValue = NO_MODIFICATION_ALLOWED_ERR; results = new testResults("Core0019M"); results.description = "The \"setNamedItem(arg)\" method raises a " + "NO_MODIFICATION_ALLOWED_ERR DOMException if this "+ "NamedNodeMap is readonly."; // // Create a NamedNodeMap object and attempt to add a node to it. // Should raise an exception. // testNode = getEntity("ent4"); entityDesc = testNode.firstChild; try { entityDesc.attributes.setNamedItem(newAttrNode); } catch(DOMException) { computedValue = DOMException.code; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0019M -------------------------- // //--------------------------- test case core-0020M --------------------------- // // Testing feature - The "setNamedItem(arg) method raises an // INUSE_ATTRIBUTE_ERR DOMException if "arg" is an Attr // that is already an attribute of another Element. // // Testing approach - Create a NamedNodeMap object from the attributes of the // third child and attempt to add an attribute that is // already being used by the first employee. An attempt // to add such an attribute should raise the desired // exception. // // Semantic Requirements: 18 // // Last modification date - March 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0020M() { var computedValue= ""; var inUseAttribute = ""; var firstEmployee = ""; var testNode = ""; var expectedValue = INUSE_ATTRIBUTE_ERR; results = new testResults("Core0020M"); results.description = "The \"setNamedItem(arg)\" method raises an "+ "INUSE_ATTRIBUTE_ERR DOMException if \"arg\" "+ "is an Attr node that is already an attribute "+ "of another Element."; firstEmployee = new nodeObject(FIRST,SIXTH); inUseAttribute = firstEmployee.node.getAttributeNode("domestic"); // // Attempt to add an attribute that is already used by another element // should raise an exception. // testNode = new nodeObject(THIRD,SIXTH); try { testNode.attributes.setNamedItem(inUseAttribute); } catch (DOMException) { computedValue = DOMException.code; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0020M -------------------------- // //--------------------------- test case core-0021M --------------------------- // // Testing feature - The "removeNamedItem(name) method raises an // NOT_FOUND_ERR DOMException if there is no node // named "name" in the map. // // Testing approach - Create a NamedNodeMap object from the attributes of the // last child of the third employee and attempt to // remove the "district" attribute. There is no node named // "district" in the list and therefore the desired // exception should be raised. // // Semantic Requirements: 19 // // Last modification date - March 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0021M() { var computedValue = ""; var testNode = ""; var expectedValue = NOT_FOUND_ERR; results = new testResults("Core0021M"); results.description = "The \"removeNamedItem(name)\" method raises a " + "NOT_FOUND_ERR DOMException if there is no node "+ "named \"name\" in the map."; // // Create a NamedNodeMap object and attempt to remove an attribute that // is not in the list should raise an exception. // testNode = new nodeObject(THIRD,SIXTH); try { testNode.attributes.removeNamedItem("district"); } catch(DOMException) { computedValue = DOMException.code; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0021M --------------------------