//************************************************************************** // // // National Institute Of Standards and Technology // DTS Version 1.1 // // HTMLDocument Interface //************************************************************************** function HTMLDocument() { var tests = new Array (HTML0001HDOC(),HTML0002HDOC(),HTML0003HDOC(),HTML0004HDOC(),HTML0005HDOC(),HTML0006HDOC(),HTML0007HDOC(),HTML0008HDOC(),HTML0009HDOC(),HTML0010HDOC(),HTML0011HDOC(),HTML0012HDOC(),HTML0013HDOC(),HTML0014HDOC(),HTML0015HDOC(),HTML0016HDOC()); return tests; } //------------------------ test case HTML-0001HDOC ------------------------- // // Testing feature - The "title" attribute specifies the title of the // document as specified by the TITLE element. // // Testing approach - Retrieve the "title" attribute from the // testing document and examine its value. It should // be equal to "THE NIST DOM TEST SUITE VERSION 1.1 // (HTML)". // // Semantic Requirements: 1 // // Last modification date - September 1, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0001HDOC() { var computedValue = ""; var expectedValue = "THE NIST DOM TEST SUITE VERSION 1.1 (HTML)"; var results = ""; var testNode = ""; results = new testResults("HTML0001HDOC"); results.description = "The \"title\" attribute specifies the title "+ "of the document as specfied by the TITLE "+ "element."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "title" attribute. // computedValue = testNode.title; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0001HDOC ------------------------- // //------------------------ test case HTML-0002HDOC ------------------------- // // Testing feature - The "referrer" attribute returns the URI of the page // that links to this document. // // Testing approach - Retrieve the "referrer" attribute from the // testing document and examine its value. It // should be equal to the string stored in the // variable BASE1. // // Semantic Requirements: 2 // // Last modification date - September 8, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0002HDOC() { var computedValue = ""; var expectedValue = BASE1;; var results = ""; var testNode = ""; results = new testResults("HTML0002HDOC"); results.description = "The \"referrer\" attribute returns the URI of "+ "the page that linked to this page."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "referrer" attribute. // computedValue = testNode.referrer; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0002HDOC ------------------------- // //------------------------ test case HTML-0003HDOC ------------------------- // // Testing feature - The "domain" attribute specifies the domain name of // the server that served the document. // // Testing approach - Retrieve the "domain" attribute from the // testing document and examine its value. It should // be equal to the string stored in the variable // BASE2. // // Semantic Requirements: 3 // // Last modification date - September 8, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0003HDOC() { var computedValue = ""; var expectedValue = BASE2; var results = ""; var testNode = ""; results = new testResults("HTML0003HDOC"); results.description = "The \"domain\" attribute specifies the domain "+ "name of the server that served this document."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "domain" attribute. // computedValue = testNode.domain; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0003HDOC ------------------------- // //------------------------ test case HTML-0004HDOC ------------------------- // // Testing feature - The "URL" attribute specifies the complete URI of // the document. // // Testing approach - Retrieve the "URL" attribute from the // testing document and examine its value. It should // be equal to the string stored in the varibale // BASE3. // // Semantic Requirements: 4 // // Last modification date - September 8, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0004HDOC() { var computedValue = ""; var expectedValue = BASE3; var results = ""; var testNode = ""; results = new testResults("HTML0004HDOC"); results.description = "The \"URL\" attribute specifies the "+ "complete URI of the document."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "URL" attribute. // computedValue = testNode.URL; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0004HDOC ------------------------- // //------------------------ test case HTML-0005HDOC ------------------------- // // Testing feature - The "body" attribute returns the BODY element for // documents with BODY contents. // // Testing approach - Retrieve the "body" attribute from the // testing document and examine its value. It should // return an HTMLElement object that contains the // body of the document and whose "id" attribute is // equal to "test-body". // // Semantic Requirements: 5 // // Last modification date - October 26, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0005HDOC() { var computedValue = ""; var expectedValue = "TEST-BODY"; var results = ""; var testNode = ""; var documentBody = ""; results = new testResults("HTML0005HDOC"); results.description = "The \"body\" attribute returns the BODY "+ "element for documents with BODY contents."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "body" attribute. // documentBody = testNode.body; computedValue = documentBody.id.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0005HDOC ------------------------- // //------------------------ test case HTML-0006HDOC ------------------------- // // Testing feature - The "body" attribute returns the outermost FRAMESET // for frameset documents. // // Testing approach - Retrieve the "body" attribute from the frameset // document and examine its value. It should // return an HTMLElement object that contains the // outermost FRAMESET element whose "id" attribute // is equal to "frameset-1". // // Semantic Requirements: 6 // // Last modification date - September 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0006HDOC() { var computedValue = ""; var expectedValue = "FRAMESET-1"; var results = ""; var testNode = ""; var outerFrameset = ""; results = new testResults("HTML0006HDOC"); results.description = "The \"body\" attribute returns the "+ "outermost FRAMESET element for "+ "frameset documents."; // // Retrieve targeted data. // testNode = getFramesetDocument(); // // and access its "body" attribute and in turn the "id" attribute. // outerFrameset = testNode.body.id; computedValue = outerFrameset.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0006HDOC ------------------------- // //------------------------ test case HTML-0007HDOC ------------------------- // // Testing feature - The "images" attribute returns a collection of all IMG // elements in a document. // // Testing approach - Retrieve the "images" attribute from the // testing document and examine its value. It should // return an HTMLCollection object that contains all // IMG elements in the document, it's length should // be equal to 1 and the id of the only IMG // element should be "image-1". // // Semantic Requirements: 7 // // Last modification date - November 4, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0007HDOC() { var computedValue = ""; var expectedValue = "IMAGE-1 1"; var results = ""; var testNode = ""; var imagesList = ""; results = new testResults("HTML0007HDOC"); results.description = "The \"images\" attribute returns a collection "+ "of all IMG elements in the document."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "images" attribute. // imagesList = testNode.images; computedValue = imagesList(FIRST).id + " "; computedValue += imagesList.length; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0007HDOC ------------------------- // //------------------------ test case HTML-0008HDOC ------------------------- // // Testing feature - The "applets" attribute returns a collection of all // OBJECT elements that include applets and APPLETS // elements in a document. // // Testing approach - Retrieve the "applets" attribute from the // testing document and examine its value. It should // return an HTMLCollection object that contains all // IMG elements in the document, it's length should // be equal to 3. // // Semantic Requirements: 8 // // Last modification date - September 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0008HDOC() { var computedValue = ""; var expectedValue = 3; var results = ""; var testNode = ""; var appletsList = ""; results = new testResults("HTML0008HDOC"); results.description = "The \"applets\" attribute returns a collection "+ "of all the OBJECT elements that contains applets "+ "and APPLET elements."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "applets" attribute. // appletsList = testNode.applets; computedValue = appletsList.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0008HDOC ------------------------- // //------------------------ test case HTML-0009HDOC ------------------------- // // Testing feature - The "links" attribute returns a collection of all // AREA and A elements in a document with a value for // the "href" attribute. // // Testing approach - Retrieve the "links" attribute from the // testing document and examine its value. It should // return an HTMLCollection object that contains all // AREA and anchor (A) elements in the document whose // length is 5. // // Semantic Requirements: 9 // // Last modification date - September 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0009HDOC() { var computedValue = ""; var expectedValue = 5; var results = ""; var testNode = ""; var linksList = ""; results = new testResults("HTML0009HDOC"); results.description = "The \"links\" attribute returns a collection "+ "of all the AREA and A elements that contains "+ "a value for the \"href\" attribute."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "links" attribute. // linksList = testNode.links; computedValue = linksList.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0009HDOC ------------------------- // //------------------------ test case HTML-0010HDOC ------------------------- // // Testing feature - The "forms" attribute returns a collection of all // the forms in a document. // // Testing approach - Retrieve the "forms" attribute from the // testing document and examine its value. It should // return an HTMLCollection object that contains all // the forms defined in the document and whose length // 2. // // Semantic Requirements: 10 // // Last modification date - September 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0010HDOC() { var computedValue = ""; var expectedValue = 2; var results = ""; var testNode = ""; var formsList = ""; results = new testResults("HTML0010HDOC"); results.description = "The \"forms\" attribute returns a collection "+ "of all the forms defined in a document."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "forms" attribute. // formsList = testNode.forms; computedValue = formsList.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0010HDOC ------------------------- // //------------------------ test case HTML-0011HDOC ------------------------- // // Testing feature - The "anchors" attribute returns a collection of all // anchor (A) elements with values for the name // attribute. // // Testing approach - Retrieve the "anchors" attribute from the // testing document and examine its value. It should // return an HTMLCollection object that contains all // the A elemnts with the value for the name attribute // and whose length is 1. // // Semantic Requirements: 11 // // Last modification date - September 30, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0011HDOC() { var computedValue = ""; var expectedValue = 1; var results = ""; var testNode = ""; var formsList = ""; results = new testResults("HTML0011HDOC"); results.description = "The \"anchors\" attribute returns a collection "+ "of all the anchor (A) elements with values "+ "for the name attribute."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "anchors" attribute. // formsList = testNode.anchors; computedValue = formsList.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0011HDOC ------------------------- // //------------------------ test case HTML-0012HDOC ------------------------- // // Testing feature - The "cookie" attribute returns the cookies associated // with this document. // // Testing approach - Retrieve the "cookie" attribute from the // testing document and examine its value. It should // return the empty string as there are no cookies // associated with the testing document. // // Semantic Requirements: 12 // // Last modification date - September 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0012HDOC() { var computedValue = ""; var expectedValue = ""; var results = ""; var testNode = ""; results = new testResults("HTML0012HDOC"); results.description = "The \"cookie\" attribute returns an empty "+ "string if there are no cookies associated "+ "with this document."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "cookie" attribute. // computedValue = testNode.cookie; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0012HDOC ------------------------- // //------------------------ test case HTML-0013HDOC ------------------------- // // Testing feature - The "getElementById(elementId)" method returns the element // whose "id" attribute is given by elementId. // // Testing approach - Retrieve the testing document and invoke its // "getElementById(elementId)" method with elementId = // "table-1". The method should return the first TABLE // element. // // Semantic Requirements: 13 // // Last modification date - September 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0013HDOC() { var computedValue = ""; var expectedValue = "TABLE-1"; var results = ""; var testNode = ""; var tableOne = ""; results = new testResults("HTML0013HDOC"); results.description = "The \"getElementById(elementId)\" method "+ "returns the element whose \"id\" attribute "+ "is given by elementId."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "getElementById(elementId)" method. // tableOne = testNode.getElementById("table-1"); computedValue = tableOne.id; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0013HDOC ------------------------- // //------------------------ test case HTML-0014HDOC ------------------------- // // Testing feature - The "getElementById(elementId)" method returns null if // if no element has the "id" attribute given by // elementId. // // Testing approach - Retrieve the testing document and invoke its // "getElementById(elementId)" method with elementId = // "noId". The method should return a null value since // there are no elements with that "id" value. // // Semantic Requirements: 14 // // Last modification date - September 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0014HDOC() { var computedValue = ""; var expectedValue = null; var results = ""; var testNode = ""; results = new testResults("HTML0014HDOC"); results.description = "The \"getElementById(elementId)\" method "+ "returns null if no element has the \"id\" "+ "attribute given by elementId."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "getElementById(elementId)" method. // computedValue = testNode.getElementById("noId"); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0014HDOC ------------------------- // //------------------------ test case HTML-0015HDOC ------------------------- // // Testing feature - The "getElementsByName(elementName)" method returns the // (possibly empty) collection of elements whose name // is given by elementName. (non-empty collection). // // Testing approach - Retrieve the testing document and invoke its // "getElementsByName(elementName)" method with // elementId = "dts-map". The method should return // a collection of MAP elements whose length is 1. // // Semantic Requirements: 15 // // Last modification date - November 4, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0015HDOC() { var computedValue = ""; var expectedValue = "1 DTS-MAP"; var results = ""; var testNode = ""; var tableList = ""; results = new testResults("HTML0015HDOC"); results.description = "The \"getElementsByName(elementName)\" method "+ "returns the (possible empty) collection of "+ "elements whose name is given by "+ "\"elementName\" (Non-empty collection)."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "getElementsByName(elementName)" method. // tableList = testNode.getElementsByName("dts-map"); computedValue = tableList.length; computedValue = computedValue+" "+tableList(FIRST).name.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0015HDOC ------------------------- // //------------------------ test case HTML-0016HDOC ------------------------- // // Testing feature - The "getElementsByName(elementName)" method returns the // (possibly empty) collection of elements whose name // is given by elementName. (empty collection). // // Testing approach - Retrieve the testing document and invoke its // "getElementsByName(elementName)" method with // elementId = "noName". The method should return // a collection whose length is 0. // // Semantic Requirements: 16 // // Last modification date - September 10, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0016HDOC() { var computedValue = ""; var expectedValue = 0; var results = ""; var testNode = ""; var tableList = ""; results = new testResults("HTML0016HDOC"); results.description = "The \"getElementsByName(elementName)\" method "+ "returns the (possible empty) collection of "+ "elements whose name is given by "+ "\"elementName\" (empty collection)."; // // Retrieve targeted data. // testNode = getHTMLDocument(); // // and access its "getElementsByName(elementName)" method. // tableList = testNode.getElementsByName("noName"); computedValue = tableList.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0016HDOC -------------------------