chromium/third_party/blink/web_tests/fast/forms/form-collection-elements.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("This test lists all the elements of a form per http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-listed.");
debug("This test does not add object element as a listed element. Separate test will cover that.");

var container = document.createElement('div');
document.body.appendChild(container);

container.innerHTML = '<form id="form1">' +
    '<button id=button1></button>' +
    '<fieldset id=fieldset1><legend id=legend1></legend></fieldset>' +
    '<input id=inputhidden type=hidden>' +
    '<input id=inputtext type=text>' +
    '<input id=inputsearch type=search>' +
    '<input id=inputurl type=url>' +
    '<input id=inputemail type=email>' +
    '<input id=inputpassword type=password>' +
    '<input id=inputdate type=date>' +
    '<input id=inputnumber type=number>' +
    '<input id=inputrange type=range>' +
    '<input id=inputcolor type=color>' +
    '<input id=inputcheckbox type=checkbox>' +
    '<input id=inputradio type=radio>' +
    '<input id=inputfile type=file>' +
    '<input id=inputsubmit type=submit>' +
    '<input id=inputimage type=image>' +
    '<input id=inputreset type=reset>' +
    '<input id=inputbutton type=button>' +
    '<label id=label1></label>' +
    '<meter id=meter1></meter>' +
    '<object id=object1></object>' +
    '<output id=output1></output>' +
    '<progress id=progress1></progress>' +
    '<select id=select1>' +
    '    <optgroup id=optgroup1>group1</optgroup>' +
    '    <option id=option1>option1</option>' +
    '</select>' +
    '<textarea id=textarea1></textarea>' +
    '</form>';

var owner = document.getElementById('form1');

shouldBe('owner.elements.length', '22');
shouldBe('owner.elements[0].id', "'button1'");
shouldBe('owner.elements[1].id', "'fieldset1'");
shouldBe('owner.elements[2].id', "'inputhidden'");
shouldBe('owner.elements[3].id', "'inputtext'");
shouldBe('owner.elements[4].id', "'inputsearch'");
shouldBe('owner.elements[5].id', "'inputurl'");
shouldBe('owner.elements[6].id', "'inputemail'");
shouldBe('owner.elements[7].id', "'inputpassword'");
shouldBe('owner.elements[8].id', "'inputdate'");
shouldBe('owner.elements[9].id', "'inputnumber'");
shouldBe('owner.elements[10].id', "'inputrange'");
shouldBe('owner.elements[11].id', "'inputcolor'");
shouldBe('owner.elements[12].id', "'inputcheckbox'");
shouldBe('owner.elements[13].id', "'inputradio'");
shouldBe('owner.elements[14].id', "'inputfile'");
shouldBe('owner.elements[15].id', "'inputsubmit'");
shouldBe('owner.elements[16].id', "'inputreset'");
shouldBe('owner.elements[17].id', "'inputbutton'");
shouldBe('owner.elements[18].id', "'object1'");
shouldBe('owner.elements[19].id', "'output1'");
shouldBe('owner.elements[20].id', "'select1'");
shouldBe('owner.elements[21].id', "'textarea1'");
</script>
</body>
</html>