//************************************************************************** // // // National Institute Of Standards and Technology // DTS Version 1.1 // // HTMLFormElement Interface //************************************************************************** function HTMLFormElement() { var tests = new Array (HTML0001HFME(),HTML0002HFME(),HTML0003HFME(),HTML0004HFME(),HTML0005HFME(),HTML0006HFME(),HTML0007HFME(),HTML0008HFME(),HTML0009HFME(),HTML0010HFME()); return tests; } //------------------------ test case HTML-0001HFME ------------------------- // // Testing feature - The "elements" attribute returns a collection of // all control elements in the form. // // Testing approach - Retrieve the "elements" attribute from the first // FORM element of the testing document and examine // its value. It should be equal to a collection // whose length is 1. // // Semantic Requirements: 1 // // Last modification date - October 25, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0001HFME() { var computedValue = ""; var expectedValue = 10; var results = ""; var testNode = ""; var formsCollection = ""; results = new testResults("HTML0001HFME"); results.description = "The \"elements\" attribute returns a "+ "collection of all control elements in "+ "the form."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and access its "elements" attribute. // formsCollection = testNode.node.elements; computedValue = formsCollection.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0001HFME ------------------------- // //------------------------ test case HTML-0002HFME ------------------------- // // Testing feature - The "length" attribute contains the number of form // controls in the form. // // Testing approach - Retrieve the "length" attribute from the first // FORM element of the testing document and examine // its value. // // Semantic Requirements: 2 // // Last modification date - October 25, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0002HFME() { var computedValue = ""; var expectedValue = 10; var results = ""; var testNode = ""; results = new testResults("HTML0002HFME"); results.description = "The \"length\" attribute contains the "+ "number of form controls in the form."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and access its "length" attribute. // computedValue = testNode.node.length; // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0002HFME ------------------------- // //------------------------ test case HTML-0003HFME ------------------------- // // Testing feature - The "name" attribute names the form. // // Testing approach - Retrieve the first FORM element of the testing document // and set its "name" attribute to "form1_name", then // retrieve it back. // // Semantic Requirements: 3 // // Last modification date - November 1, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0003HFME() { var computedValue = ""; var expectedValue = "FORM1_NAME"; var results = ""; var testNode = ""; results = new testResults("HTML0003HFME"); results.description = "The \"name\" attribute names the form."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and set its "name" attribute. // testNode.node.name="form1_name"; computedValue = testNode.node.name; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0003HFME ------------------------- // //------------------------ test case HTML-0004HFME ------------------------- // // Testing feature - The "acceptCharset" attribute contains a list of // character sets supported by the server. // // Testing approach - Retrieve the "acceptCharset" attribute from the first // FORM element of the testing document and examine // its value. It should be equal to "US-ASCII". // // Semantic Requirements: 4 // // Last modification date - August 25, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0004HFME() { var computedValue = ""; var expectedValue = "US-ASCII"; var results = ""; var testNode = ""; results = new testResults("HTML0004HFME"); results.description = "The \"acceptCharset\" attribute contains a "+ "list of character sets supported by the "+ "server."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and access its "acceptCharset" attribute. // computedValue = testNode.node.acceptCharset; computedVAlue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0004HFME ------------------------- // //------------------------ test case HTML-0005HFME ------------------------- // // Testing feature - The "action" attribute specifies the server-side form // handler. // // Testing approach - Retrieve the "action" attribute from the first // FORM element of the testing document and examine // its value. It should be equal to "./files/getData.pl". // // Semantic Requirements: 5 // // Last modification date - October 4, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0005HFME() { var computedValue = ""; var expectedValue = "./FILES/GETDATA.PL"; var results = ""; var testNode = ""; results = new testResults("HTML0005HFME"); results.description = "The \"action\" attribute specifies the "+ "server-side form handler"; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and access its "action" attribute. // computedValue = testNode.node.action; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0005HFME ------------------------- // //------------------------ test case HTML-0006HFME ------------------------- // // Testing feature - The "enctype" attribute specifies the content type of // the subimitted form. // // Testing approach - Retrieve the "enctype" attribute from the first // FORM element of the testing document and examine // its value. It should be equal to "application/x-www // -form-urlencoded". // // Semantic Requirements: 6 // // Last modification date - September 2, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0006HFME() { var computedValue = ""; var expectedValue = "APPLICATION/X-WWW-FORM-URLENCODED"; var results = ""; var testNode = ""; results = new testResults("HTML0006HFME"); results.description = "The \"enctype\" attribute specifies the "+ "content type of the submitted form."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and access its "enctype" attribute. // computedValue = testNode.node.enctype; // computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0006HFME ------------------------- // //------------------------ test case HTML-0007HFME ------------------------- // // Testing feature - The "method" attribute specifies the HTTP method // used to submit the form. // // Testing approach - Retrieve the "method" attribute from the first // FORM element of the testing document and examine // its value. It should be equal to "post". // // Semantic Requirements: 7 // // Last modification date - September 2, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0007HFME() { var computedValue = ""; var expectedValue = "POST"; var results = ""; var testNode = ""; results = new testResults("HTML0007HFME"); results.description = "The \"method\" attribute specifies the "+ "HTTP method used to submit the form."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and access its "method" attribute. // computedValue = testNode.node.method; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0007HFME ------------------------- // //------------------------ test case HTML-0008HFME ------------------------- // // Testing feature - The "target" attribute specifies the frame to // render the resource in. // // Testing approach - Retrieve the "target" attribute from the first // FORM element of the testing document and examine // its value. It should be equal to "_blank". // // Semantic Requirements: 8 // // Last modification date - September 2, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0008HFME() { var computedValue = ""; var expectedValue = "_BLANK"; var results = ""; var testNode = ""; results = new testResults("HTML0008HFME"); results.description = "The \"target\" attribute specifies the "+ "frame to render the resource in."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,FIRST); // // and access its "target" attribute. // computedValue = testNode.node.target; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0008HFME ------------------------- // //------------------------ test case HTML-0009HFME ------------------------- // // Testing feature - The "submit()" method submits this form. // // Testing approach - Retrieve the the second FORM element of the testing // document and invoke its "submit()" method. Invocation // of this method should cause the "onsubmit" event to be // triggered and in turn the JavaScript method "setName" // to be executed which changes the element's name. This // test does not work properly. // // Semantic Requirements: 9 // // Last modification date - November 1, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0009HFME() { var computedValue = ""; var expectedValue = "EN-US"; var results = ""; var testNode = ""; results = new testResults("HTML0009HFME"); results.description = "The \"submit()\" method submits this "+ "form."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,SECOND); // // and invoke its "submit()" method. // // testNode.node.submit(); computedValue = testNode.node.lang; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0009HFME ------------------------- // //------------------------ test case HTML-0010HFME ------------------------- // // Testing feature - The "reset()" method submits this form. // // Testing approach - Retrieve the the first FORM element of the testing // document and change to name of the element to "newname", // then invoke its "reset()" method. Upon invocation of // this method, the form should have all its elements // restored to their default values. // // Semantic Requirements: 10 // // Last modification date - October 4, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function HTML0010HFME() { var computedValue = ""; var expectedValue = "NEW_TITLE"; var results = ""; var testNode = ""; results = new testResults("HTML0010HFME"); results.description = "The \"reset()\" method restores the "+ "element's default values."; // // Retrieve targeted data. // testNode = new HTMLNodeObject(FORM,SECOND); // // and access its "reset()" method. // testNode.node.reset(); computedValue = testNode.node.title; computedValue = computedValue.toUpperCase(); // // Write out results // results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case HTML-0010HFME -------------------------