adding some more testcases (from jkeiser) the formctl regression testcases not part of the build

This commit is contained in:
bernd.mielke%snafu.de 2002-03-09 19:01:12 +00:00
Родитель 57b9b0d355
Коммит 916cbf266d
10 изменённых файлов: 1437 добавлений и 1 удалений

Просмотреть файл

@ -7,4 +7,14 @@ file:///s|/mozilla/layout/html/tests/formctls/base/select_js.html
file:///s|/mozilla/layout/html/tests/formctls/base/selectsize3_js.html
file:///s|/mozilla/layout/html/tests/formctls/base/testarea_wrap.html
file:///s|/mozilla/layout/html/tests/formctls/base/textarea_sizes.html
file:///s|/mozilla/layout/html/tests/formctls/base/textarea_tests.html
file:///s|/mozilla/layout/html/tests/formctls/base/textarea_tests.html
file:///s|/mozilla/layout/html/tests/formctls/base/select_disabled.html
file:///s|/mozilla/layout/html/tests/formctls/base/select_init.html
file:///s|/mozilla/layout/html/tests/formctls/base/select1_js.html
file:///s|/mozilla/layout/html/tests/formctls/base/select_jsadd.html
file:///s|/mozilla/layout/html/tests/formctls/base/select_onchange.html
file:///s|/mozilla/layout/html/tests/formctls/base/radio_disabled.html
file:///s|/mozilla/layout/html/tests/formctls/base/radio_jsadd.html
file:///s|/mozilla/layout/html/tests/formctls/base/radio_onchange.html
file:///s|/mozilla/layout/html/tests/formctls/base/radio_init.html

Просмотреть файл

@ -0,0 +1,38 @@
<HTML>
<HEAD>
<TITLE>Radio Button Test 2 (Disabled)</TITLE>
<SCRIPT SRC="radio.js"></SCRIPT>
</HEAD>
<BODY>
<FORM NAME=mainform>
<INPUT TYPE=reset>
<FIELDSET>
<LEGEND>1, 3, 4, 7 Disabled</LEGEND>
<INPUT TYPE=radio DISABLED NAME=a VALUE=1>
<INPUT TYPE=radio NAME=a VALUE=2>
<INPUT TYPE=radio DISABLED NAME=a VALUE=3>
<INPUT TYPE=radio DISABLED NAME=a VALUE=4>
<INPUT TYPE=radio NAME=a VALUE=5>
<INPUT TYPE=radio NAME=a VALUE=6>
<INPUT TYPE=radio DISABLED NAME=a VALUE=7>
<BR>
<INPUT TYPE=button VALUE="Show all checked" onClick="alert(getRadioVal(document.mainform.a))">
<INPUT TYPE=button VALUE="Set .checked on #3" onClick="document.mainform.a[2].checked = true">
<INPUT TYPE=button VALUE="Set all .checked" onClick="setAllChecked(document.mainform.a, true)">
</FIELDSET>
<FIELDSET>
<LEGEND>All Disabled</LEGEND>
<INPUT TYPE=radio DISABLED NAME=b VALUE=1>
<INPUT TYPE=radio DISABLED NAME=b VALUE=2>
<INPUT TYPE=radio DISABLED NAME=b VALUE=3>
<INPUT TYPE=radio DISABLED NAME=b VALUE=4>
<INPUT TYPE=radio DISABLED NAME=b VALUE=5>
<INPUT TYPE=radio DISABLED NAME=b VALUE=6>
<INPUT TYPE=radio DISABLED NAME=b VALUE=7>
<BR>
<INPUT TYPE=button VALUE="Show all checked" onClick="alert(getRadioVal(document.mainform.b))">
<INPUT TYPE=button VALUE="Set .checked on #3" onClick="document.mainform.b[2].checked = true">
<INPUT TYPE=button VALUE="Set all .checked" onClick="setAllChecked(document.mainform.b, true)">
</FIELDSET>
</BODY>
</HTML>

Просмотреть файл

@ -0,0 +1,41 @@
<HTML>
<HEAD>
<TITLE>Radio Button Test 1 (Init)</TITLE>
<SCRIPT SRC="radio.js"></SCRIPT>
</HEAD>
<BODY>
<FORM NAME=mainform>
<INPUT TYPE=reset> <INPUT TYPE=submit>
<FIELDSET>
<LEGEND>None Selected</LEGEND>
<INPUT TYPE=radio NAME=a VALUE=1>
<INPUT TYPE=radio NAME=a VALUE=2>
<INPUT TYPE=radio NAME=a VALUE=3>
<BR>
<INPUT TYPE=button VALUE="Show all checked" onClick="alert(getRadioVal(document.mainform.a))">
<INPUT TYPE=button VALUE="Set .checked on #3" onClick="document.mainform.a[2].checked = true">
<INPUT TYPE=button VALUE="Set all .checked" onClick="setAllChecked(document.mainform.a, true)">
</FIELDSET>
<FIELDSET>
<LEGEND>One Selected</LEGEND>
<INPUT TYPE=radio NAME=b VALUE=1>
<INPUT TYPE=radio CHECKED NAME=b VALUE=2>
<INPUT TYPE=radio NAME=b VALUE=3>
<BR>
<INPUT TYPE=button VALUE="Show all checked" onClick="alert(getRadioVal(document.mainform.b))">
<INPUT TYPE=button VALUE="Set .checked on #3" onClick="document.mainform.b[2].checked = true">
<INPUT TYPE=button VALUE="Set all .checked" onClick="setAllChecked(document.mainform.b, true)">
</FIELDSET>
<FIELDSET>
<LEGEND>All Selected</LEGEND>
<INPUT TYPE=radio CHECKED NAME=c VALUE=1>
<INPUT TYPE=radio CHECKED NAME=c VALUE=2>
<INPUT TYPE=radio NAME=c VALUE=3 CHECKED>
<BR>
<INPUT TYPE=button VALUE="Show all checked" onClick="alert(getRadioVal(document.mainform.c))">
<INPUT TYPE=button VALUE="Set .checked on #3" onClick="document.mainform.c[2].checked = true">
<INPUT TYPE=button VALUE="Set all .checked" onClick="setAllChecked(document.mainform.c, true)">
</FIELDSET>
</FORM>
</BODY>
</HTML>

Просмотреть файл

@ -0,0 +1,26 @@
<html>
<head>
<title>Radio Button Test 3 (onChange)</title>
<script SRC="radio.js"></SCRIPT>
</head>
<body>
<form NAME=mainform>
<input TYPE=reset> <input TYPE=submit>
<fieldset>
<legend>onChange test</legend>
R1 <input TYPE=radio ID=R1 NAME=a VALUE=1">
R2 <input TYPE=radio ID=R2 NAME=a VALUE=2">
R3 <input TYPE=radio ID=R3 NAME=a VALUE=3">
<br ID=addbeforeme>
<input TYPE=button VALUE="Change type of R2 to checkbox" onClick="document.getElementById('R2').type = 'checkbox'">
<input TYPE=button VALUE="Change type of R2 back to radio" onClick="document.getElementById('R2').type = 'radio'"><BR>
<input TYPE=button VALUE="Change name of R2 to b" onClick="document.getElementById('R2').name = 'b'">
<input TYPE=button VALUE="Change name of R2 back to a" onClick="document.getElementById('R2').name = 'a'"><BR>
<input TYPE=button VALUE="Remove second radio in group a" onClick="document.mainform.a[1].parentNode.removeChild(document.mainform.a[1])"><BR>
Add new radio buttons as checked: <input TYPE=checkbox NAME=addchecked><BR>
Add new radio buttons with name: <input type=text NAME=addname VALUE="a"><BR>
<input TYPE=button VALUE="Add New Radio" onClick="addNewRadio()"><BR>
</fieldset>
</form>
</body>
</html>

Просмотреть файл

@ -0,0 +1,21 @@
<html>
<head>
<title>Radio Button Test 3 (onChange)</title>
<script SRC="radio.js"></SCRIPT>
</head>
<body>
<form NAME=mainform>
<input TYPE=reset> <input TYPE=submit>
<fieldset>
<legend>onChange test</legend>
<input TYPE=radio NAME=a VALUE=1 onChange="alert('1 changed')">
<input TYPE=radio NAME=a VALUE=2 onChange="alert('2 changed')">
<input TYPE=radio NAME=a VALUE=3 onChange="alert('3 changed')">
<br>
<input TYPE=button VALUE="Show all checked" onClick="alert(getRadioVal(document.mainform.a))">
<input TYPE=button VALUE="Set .checked on #3" onClick="document.mainform.a[2].checked = true">
<input TYPE=button VALUE="Set all .checked" onClick="setAllChecked(document.mainform.a, true)">
</fieldset>
</form>
</body>
</html>

Просмотреть файл

@ -0,0 +1,258 @@
<HTML>
<HEAD>
<TITLE>Select Tests: JavaScript</TITLE>
<SCRIPT>
function typeTest(sel) {
if(sel.multiple && sel.type != "select-multi") {
alert("sel.type is '" + sel.type + "' instead of select-multi!");
} else if(sel.type != "select-one") {
alert("sel.type is '" + sel.type + "' instead of select-one!");
}
}
function selIndTest(sel) {
alert(sel.selectedIndex);
}
function selIndTestW(sel) {
sel.selectedIndex = 2;
}
function valueTest(sel) {
alert(sel.value);
}
function valueTestW(sel) {
sel.value = 4;
}
function lengthTest(sel) {
alert(sel.length);
}
function lengthTestW(sel) {
if(sel.length == 20) {
sel.length = 5;
} else {
sel.length = 20;
}
}
function formTest(sel) {
if(sel.form == null || sel.form.elements == null) {
alert("Select's form doesn't appear to be a form!");
}
}
// options is tested adequately in other tests
function disabledTest(sel) {
alert(sel.disabled);
}
function disabledTestW(sel) {
sel.disabled = !sel.disabled;
}
function multipleTest(sel) {
alert(sel.multiple);
}
function multipleTestW(sel) {
sel.multiple = !sel.multiple;
}
function nameTest(sel) {
alert(sel.name);
}
function nameTestW(sel) {
sel.name = sel.name + "x";
}
function sizeTest(sel) {
alert(sel.size);
}
function sizeTestW(sel) {
if(sel.size == 10) {
sel.size = -1;
} else if(sel.size == -1) {
sel.size = 0;
} else if(sel.size == 0) {
sel.size = 1;
} else {
sel.size = 10;
}
}
function hideTest(sel) {
sel.style.display = 'none';
}
function unhideTest(sel) {
sel.style.display = 'block';
}
</SCRIPT>
<BODY>
<H2>Select Tests: JavaScript</H2>
<TABLE BORDER=1>
<TR>
<TH>display: none init</TH>
<TD>
<B>Steps:</B> Click the buttons to view and set things. Start by viewing everything.<BR>
<B>Verify:</B> That everything behaves the same before and after clicking Unhide.
</TD>
</TR>
<TR>
<TH>JavaScript</TH>
<TD>
<B>Steps:</B> Click Unhide to view the select. Click the various buttons.<BR>
<B>Verify:</B> That they do what you'd expect.
</TD>
</TR>
<TR>
<TH>display: none JavaScript</TH>
<TD>
<B>Steps:</B> Click hide and try various JavaScript.<BR>
<B>Verify:</B> That they do what you'd expect, and unhide shows them properly.
</TD>
</TR>
</TABLE>
<BR>
<FORM NAME=mainform>
<INPUT TYPE=reset><BR><BR>
<TABLE BORDER=1>
<TR>
<TD><B>Dropdown</B><BR>
<INPUT TYPE=button onClick="typeTest(document.mainform.blah)" VALUE="type">
<INPUT TYPE=button onClick="formTest(document.mainform.blah)" VALUE="form"><BR>
<INPUT TYPE=button onClick="selIndTest(document.mainform.blah)" VALUE="selectedIndex">
<INPUT TYPE=button onClick="selIndTestW(document.mainform.blah)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="valueTest(document.mainform.blah)" VALUE="value">
<INPUT TYPE=button onClick="valueTestW(document.mainform.blah)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="lengthTest(document.mainform.blah)" VALUE="length">
<INPUT TYPE=button onClick="lengthTestW(document.mainform.blah)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="disabledTest(document.mainform.blah)" VALUE="disabled">
<INPUT TYPE=button onClick="disabledTestW(document.mainform.blah)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="multipleTest(document.mainform.blah)" VALUE="multiple">
<INPUT TYPE=button onClick="multipleTestW(document.mainform.blah)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="nameTest(document.mainform.blah)" VALUE="name">
<INPUT TYPE=button onClick="nameTestW(document.mainform.blah)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="sizeTest(document.mainform.blah)" VALUE="size">
<INPUT TYPE=button onClick="sizeTestW(document.mainform.blah)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="hideTest(document.mainform.blah)" VALUE="Hide">
<INPUT TYPE=button onClick="unhideTest(document.mainform.blah)" VALUE="Unhide"><BR>
<BR>
<SELECT NAME=blah STYLE="display: none">
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
<TD><B>Single w/Size</B><BR>
<INPUT TYPE=button onClick="typeTest(document.mainform.blah2)" VALUE="type">
<INPUT TYPE=button onClick="formTest(document.mainform.blah2)" VALUE="form"><BR>
<INPUT TYPE=button onClick="selIndTest(document.mainform.blah2)" VALUE="selectedIndex">
<INPUT TYPE=button onClick="selIndTestW(document.mainform.blah2)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="valueTest(document.mainform.blah2)" VALUE="value">
<INPUT TYPE=button onClick="valueTestW(document.mainform.blah2)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="lengthTest(document.mainform.blah2)" VALUE="length">
<INPUT TYPE=button onClick="lengthTestW(document.mainform.blah2)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="disabledTest(document.mainform.blah2)" VALUE="disabled">
<INPUT TYPE=button onClick="disabledTestW(document.mainform.blah2)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="multipleTest(document.mainform.blah2)" VALUE="multiple">
<INPUT TYPE=button onClick="multipleTestW(document.mainform.blah2)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="nameTest(document.mainform.blah2)" VALUE="name">
<INPUT TYPE=button onClick="nameTestW(document.mainform.blah2)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="sizeTest(document.mainform.blah2)" VALUE="size">
<INPUT TYPE=button onClick="sizeTestW(document.mainform.blah2)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="hideTest(document.mainform.blah2)" VALUE="Hide">
<INPUT TYPE=button onClick="unhideTest(document.mainform.blah2)" VALUE="Unhide"><BR>
<BR>
<SELECT NAME=blah2 SIZE=10 STYLE="display: none">
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
<TD><B>Multiple</B><BR>
<INPUT TYPE=button onClick="typeTest(document.mainform.blah3)" VALUE="type">
<INPUT TYPE=button onClick="formTest(document.mainform.blah3)" VALUE="form"><BR>
<INPUT TYPE=button onClick="selIndTest(document.mainform.blah3)" VALUE="selectedIndex">
<INPUT TYPE=button onClick="selIndTestW(document.mainform.blah3)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="valueTest(document.mainform.blah3)" VALUE="value">
<INPUT TYPE=button onClick="valueTestW(document.mainform.blah3)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="lengthTest(document.mainform.blah3)" VALUE="length">
<INPUT TYPE=button onClick="lengthTestW(document.mainform.blah3)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="disabledTest(document.mainform.blah3)" VALUE="disabled">
<INPUT TYPE=button onClick="disabledTestW(document.mainform.blah3)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="multipleTest(document.mainform.blah3)" VALUE="multiple">
<INPUT TYPE=button onClick="multipleTestW(document.mainform.blah3)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="nameTest(document.mainform.blah3)" VALUE="name">
<INPUT TYPE=button onClick="nameTestW(document.mainform.blah3)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="sizeTest(document.mainform.blah3)" VALUE="size">
<INPUT TYPE=button onClick="sizeTestW(document.mainform.blah3)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="hideTest(document.mainform.blah3)" VALUE="Hide">
<INPUT TYPE=button onClick="unhideTest(document.mainform.blah3)" VALUE="Unhide"><BR>
<BR>
<SELECT NAME=blah3 MULTIPLE SIZE=10 STYLE="display: none">
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
<TD><B>Optgroup</B><BR>
<INPUT TYPE=button onClick="typeTest(document.mainform.blah4)" VALUE="type">
<INPUT TYPE=button onClick="formTest(document.mainform.blah4)" VALUE="form"><BR>
<INPUT TYPE=button onClick="selIndTest(document.mainform.blah4)" VALUE="selectedIndex">
<INPUT TYPE=button onClick="selIndTestW(document.mainform.blah4)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="valueTest(document.mainform.blah4)" VALUE="value">
<INPUT TYPE=button onClick="valueTestW(document.mainform.blah4)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="lengthTest(document.mainform.blah4)" VALUE="length">
<INPUT TYPE=button onClick="lengthTestW(document.mainform.blah4)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="disabledTest(document.mainform.blah4)" VALUE="disabled">
<INPUT TYPE=button onClick="disabledTestW(document.mainform.blah4)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="multipleTest(document.mainform.blah4)" VALUE="multiple">
<INPUT TYPE=button onClick="multipleTestW(document.mainform.blah4)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="nameTest(document.mainform.blah4)" VALUE="name">
<INPUT TYPE=button onClick="nameTestW(document.mainform.blah4)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="sizeTest(document.mainform.blah4)" VALUE="size">
<INPUT TYPE=button onClick="sizeTestW(document.mainform.blah4)" VALUE="(set)"><BR>
<INPUT TYPE=button onClick="hideTest(document.mainform.blah4)" VALUE="Hide">
<INPUT TYPE=button onClick="unhideTest(document.mainform.blah4)" VALUE="Unhide"><BR>
<BR>
<SELECT NAME=blah4 MULTIPLE SIZE=10 STYLE="display: none">
<OPTGROUP label=first>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
</OPTGROUP>
<OPTGROUP label=second>
<OPTION SELECTED>9
<OPTION>10
</OPTGROUP>
<OPTION>11
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>

Просмотреть файл

@ -0,0 +1,285 @@
<HTML>
<HEAD>
<TITLE>Select Tests: Disabled</TITLE>
<SCRIPT>
function selectDisabled1(control) {
for(i=0;i<control.options.length;i++) {
if(control.options[i].disabled) {
control.selectedIndex = i;
}
}
}
function selectDisabled2(control) {
for(i=0;i<control.options.length;i++) {
if(control.options[i].disabled) {
control.options[i].selected = true;
}
}
}
</SCRIPT>
</HEAD>
<BODY>
<H2>Select Tests: Disabled</H2>
<TABLE BORDER=1>
<TR>
<TH>Init</TH>
<TD>
<B>Steps:</B> Come to this page with caching off.<BR>
<B>Verify:</B> Verify that the last two selects have "2" and nothing selected, respectively.
</TD>
<TR>
<TH>Reset</TH>
<TD>
<B>Steps:</B> Change values and hit the reset button.<BR>
<B>Verify:</B> That everything is the same as after Init.
</TD>
</TR>
<TR>
<TH>Normal Click</TH>
<TD>
<B>Steps:</B> Click and CTRL+Click on disabled options in all selects.<BR>
<B>Verify:</B> That disabled ones don't get changed and non-disabled ones do.
<I>Note:</I> For all these tests, note that the second optgroup is disabled and
consequently none of its options should be selectable.
</TD>
</TR>
<TR>
<TH>Shift Click</TH>
<TD>
<B>Steps:</B> click 2 and SHIFT+click 9.<BR>
<B>Verify:</B> That 3, 4 and 8 are not selected but that 2, 5-7 and 9 are.
</TD>
</TR>
<TR>
<TH>Drag</TH>
<TD>
<B>Steps:</B> Drag across the options.<BR>
<B>Verify:</B> That it works like a normal drag except disabled options are not selected.
</TD>
</TR>
<TR>
<TH>Keyboard</TH>
<TD>
<B>Steps:</B> Use up, down, left, right, home, end, and SHIFT+these keys.<BR>
<B>Verify:</B> That disabled ones are never selected but the next available non-disabled ones are.
</TD>
</TR>
<TR>
<TH>JavaScript Set Disabled</TH>
<TD>
<B>Steps:</B> Hit the JavaScript buttons.<BR>
<B>Verify:</B> That all disabled buttons (and only disabled buttons) are selected. (You have to hit Reset in between trying 1 and 2 for a particular control.) For single selects only the last disabled one will be selected (11). Ensure that the second optgroup in the multiple optgroup test has only disabled ones selected.
</TD>
</TR>
<TR>
<TH>Option Display</TH>
<TD>
<B>Steps:</B> Come to this page.<BR>
<B>Verify:</B> That the disabled options <B>(currently)</B> look the <I>same</I> as other options.
</TD>
</TR>
</TABLE>
<BR>
<FORM NAME=mainform>
<INPUT TYPE=reset><BR><BR>
<TABLE BORDER=1>
<TR>
<TD VALIGN=top>
<H3>1, 3, 4, 8, 10, 11 disabled</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah1)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah1)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah1 MULTIPLE SIZE=11>
<OPTION disabled>1
<OPTION>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION disabled>8
<OPTION>9
<OPTION disabled>10
<OPTION disabled>11
</SELECT>
</TD>
<TD VALIGN=top>
<H3>Select Disabled:</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah2)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah2)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah2 MULTIPLE SIZE=11 DISABLED>
<OPTION disabled>1
<OPTION>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION disabled>8
<OPTION>9
<OPTION disabled>10
<OPTION disabled>11
</SELECT>
</TD>
<TD VALIGN=top>
<H3>All options disabled</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah3)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah3)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah3 MULTIPLE SIZE=11>
<OPTION disabled>1
<OPTION disabled>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION disabled>5
<OPTION disabled>6
<OPTION disabled>7
<OPTION disabled>8
<OPTION disabled>9
<OPTION disabled>10
<OPTION disabled>11
</SELECT>
</TD>
</TR>
<TR>
<TD VALIGN=top>
<H3>Single Select With Size:</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah4)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah4)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah4 SIZE=11>
<OPTION disabled>1
<OPTION>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION disabled>8
<OPTION>9
<OPTION disabled>10
<OPTION disabled>11
</SELECT>
</TD>
<TD VALIGN=top>
<H3>Dropdown With Disabled At Beginning:</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah5)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah5)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah5>
<OPTION disabled>1
<OPTION>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION disabled>8
<OPTION>9
<OPTION disabled>10
<OPTION disabled>11
</SELECT>
</TD>
<TD VALIGN=top>
<H3>Dropdown With All Disabled:</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah6)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah6)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah6>
<OPTION disabled>1
<OPTION disabled>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION disabled>5
<OPTION disabled>6
<OPTION disabled>7
<OPTION disabled>8
<OPTION disabled>9
<OPTION disabled>10
<OPTION disabled>11
</SELECT>
</TD>
</TR>
<TR>
<TD VALIGN=top>
<H3>Multiple Select With Optgroup:</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah7)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah7)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah7 MULTIPLE SIZE=11>
<OPTGROUP LABEL=enabled>
<OPTION disabled>1
<OPTION>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION>5
<OPTION>6
</OPTGROUP>
<OPTGROUP disabled LABEL=disabled>
<OPTION>7
<OPTION disabled>8
<OPTION>9
<OPTION disabled>10
</OPTGROUP>
<OPTION disabled>11
</SELECT>
</TD>
<TD VALIGN=top>
<H3>Single Select With Optgroup:</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah8)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah8)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah8 SIZE=11>
<OPTGROUP LABEL=enabled>
<OPTION disabled>1
<OPTION>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION>5
<OPTION>6
</OPTGROUP>
<OPTGROUP disabled LABEL=disabled>
<OPTION>7
<OPTION disabled>8
<OPTION>9
<OPTION disabled>10
</OPTGROUP>
<OPTION disabled>11
</SELECT>
</TD>
<TD VALIGN=top>
<H3>Dropdown With Optgroup:</H3>
<INPUT TYPE=button onClick="selectDisabled1(document.mainform.blah9)" VALUE="JS: .selectedIndex"><BR>
<INPUT TYPE=button onClick="selectDisabled2(document.mainform.blah9)" VALUE="JS: option.selected"><BR>
<SELECT NAME=blah9>
<OPTGROUP LABEL=enabled>
<OPTION disabled>1
<OPTION>2
<OPTION disabled>3
<OPTION disabled>4
<OPTION>5
<OPTION>6
</OPTGROUP>
<OPTGROUP disabled LABEL=disabled>
<OPTION>7
<OPTION disabled>8
<OPTION>9
<OPTION disabled>10
</OPTGROUP>
<OPTION disabled>11
</SELECT>
</TD>
</TR>
</TABLE>
</TABLE>
</FORM>
</BODY>
</HTML>

Просмотреть файл

@ -0,0 +1,298 @@
<HTML>
<HEAD>
<TITLE>Select Tests: Init</TITLE>
<BODY>
<H2>Select Tests: Init</H2>
<TABLE BORDER=1>
<TR>
<TH>Init</TH>
<TD>
<B>Steps:</B> Come to this page with caching off.<BR>
<B>Verify:</B> Make sure the selects are initialized properly. The only one with multiple values in it should be the bottom right.
</TD>
</TR>
<TR>
<TH>Reset</TH>
<TD>
<B>Steps:</B> Change some values in every box (deselect at least one, select at least one) and hit Reset.<BR>
<B>Verify:</B> The values should be the same as they were at Init.
</TD>
</TR>
<TR>
<TH>Restore</TH>
<TD>
<B>Steps:</B> Change some values in every box (as above), go to <A HREF="http://www.google.com">Google</A>, and hit Back.<BR>
<B>Verify:</B> The values should stay at how you changed them.
</TD>
</TR>
<TR>
<TH>No Restore</TH>
<TD>
<B>Steps:</B> Change some values in every box (as above), and hit shift+reload.<BR>
<B>Verify:</B> The values should be reset.
</TD>
</TR>
</TABLE>
<BR>
<FORM NAME=mainform>
<INPUT TYPE=reset><BR><BR>
<TABLE BORDER=1>
<TR><TH></TH><TH>Nothing</TH><TH>0 values</TH><TH>1 value</TH><TH>2 values</TH><TH>optgroups</TH><TH>doc.write</TH></TR>
<TR>
<TD><B>Dropdown</B></TD>
<TD>
<SELECT NAME=blah>
</SELECT>
</TD>
<TD>
<SELECT NAME=blah2>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah3>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah4>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah5>
<OPTGROUP LABEL=first>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
</OPTGROUP>
<OPTGROUP LABEL=second>
<OPTION SELECTED>9
<OPTION>10
</OPTGROUP>
</SELECT>
</TD>
<TD>
<SELECT NAME=blah6>
<SCRIPT>
document.write("<OPTION>1");
</SCRIPT>
<OPTION>2
<OPTION>3
<OPTION>4
<SCRIPT>
document.write("<OPTGROUP><OPTION>5<OPTION>6<OPTION SELECTED>7</OPTGROUP>");
</SCRIPT>
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
</TR>
<TR>
<TD><B>Single Select</B></TD>
<TD>
<SELECT NAME=blah7 SIZE=5>
</SELECT>
</TD>
<TD>
<SELECT NAME=blah8 SIZE=5>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah9 SIZE=5>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah10 SIZE=5>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah11 SIZE=5>
<OPTGROUP LABEL=first>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
</OPTGROUP>
<OPTGROUP LABEL=second>
<OPTION SELECTED>9
<OPTION>10
</OPTGROUP>
</SELECT>
</TD>
<TD>
<SELECT NAME=blah12 SIZE=5>
<SCRIPT>
document.write("<OPTION>1");
</SCRIPT>
<OPTION>2
<OPTION>3
<OPTION>4
<SCRIPT>
document.write("<OPTGROUP><OPTION>5<OPTION>6<OPTION SELECTED>7</OPTGROUP>");
</SCRIPT>
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
</TR>
<TR>
<TD><B>Multiple Select</B></TD>
<TD>
<SELECT NAME=blah13 MULTIPLE SIZE=5>
</SELECT>
</TD>
<TD>
<SELECT NAME=blah14 MULTIPLE SIZE=5>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah15 MULTIPLE SIZE=5>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah16 MULTIPLE SIZE=5>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
<TD>
<SELECT NAME=blah17 MULTIPLE SIZE=5>
<OPTGROUP LABEL=first>
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION SELECTED>7
<OPTION>8
</OPTGROUP>
<OPTGROUP LABEL=second>
<OPTION SELECTED>9
<OPTION>10
</OPTGROUP>
</SELECT>
</TD>
<TD>
<SELECT NAME=blah18 MULTIPLE SIZE=5>
<SCRIPT>
document.write("<OPTION>1");
</SCRIPT>
<OPTION>2
<OPTION>3
<OPTION>4
<SCRIPT>
document.write("<OPTGROUP><OPTION>5<OPTION>6<OPTION SELECTED>7</OPTGROUP>");
</SCRIPT>
<OPTION>8
<OPTION SELECTED>9
<OPTION>10
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>

Просмотреть файл

@ -0,0 +1,352 @@
<HTML>
<HEAD>
<TITLE>Select Tests: JavaScript Add/Remove</TITLE>
<SCRIPT>
var selNum = 0;
function make_new(sel) {
var retval = document.createElement("OPTION");
if(document.mainform.addSelected.checked) {
retval.setAttribute("SELECTED", true);
}
retval.text = "new" + selNum;
retval.value = "new" + selNum;
selNum++;
return retval;
}
function addOptGroup(sel) {
var optgroup = document.createElement("OPTGROUP");
optgroup.label = "aGroup";
optgroup.appendChild(make_new(sel));
optgroup.appendChild(make_new(sel));
sel.insertBefore(optgroup, sel.options[1]);
}
function addOptGroup2(sel) {
var optgroup = document.createElement("OPTGROUP");
optgroup.label = "aGroup";
sel.insertBefore(optgroup, sel.options[1]);
optgroup.appendChild(make_new(sel));
optgroup.appendChild(make_new(sel));
}
function add1(sel) {
var elem = make_new(sel);
if(sel.length > 0) {
sel.add(elem, sel.options[0]);
} else {
sel.add(elem, null);
}
}
function add2(sel) {
var elem = make_new(sel);
if(sel.length > 1) {
sel.add(elem, sel.options[1]);
} else {
sel.add(elem, null);
}
}
function add3(sel) {
var elem = make_new(sel);
sel.add(elem, null);
}
function add4(sel) {
var elem = make_new(sel);
if(sel.length > 0) {
sel.insertBefore(elem, sel.options[0]);
} else {
sel.appendChild(elem);
}
}
function add5(sel) {
var elem = make_new(sel);
if(sel.length > 1) {
sel.replaceChild(elem, sel.options[1]);
}
}
function add6(sel) {
var elem = make_new(sel);
sel.appendChild(elem);
}
function remove1(sel) {
if(sel.length > 0) {
sel.remove(0);
}
}
function remove2(sel) {
if(sel.length > 1) {
sel.remove(1);
}
}
function remove3(sel) {
if(sel.length > 0) {
sel.remove(sel.length - 1);
}
}
function remove4(sel) {
if(sel.length > 0) {
sel.removeChild(sel.options[0]);
}
}
function setInner(sel) {
var newOne = "new" + selNum;
selNum++;
var newTwo = "new" + selNum;
selNum++;
sel.innerHTML = "<OPTION VALUE='" + newOne + "'>" + newOne + "</OPTION>"
+ "<OPTION VALUE='" + newTwo + "'>" + newTwo + "</OPTION>";
}
function showValues(sel) {
var myStr = "";
var firstTime = true;
for(var i=0;i<sel.length;i++) {
if(!sel.options[i].selected) {
continue;
}
if(firstTime) {
firstTime = false;
} else {
myStr += ", ";
}
myStr += sel.options[i].value;
}
alert(sel.name + ": " + myStr);
}
function showSelectedIndex(sel) {
alert(sel.selectedIndex);
}
</SCRIPT>
</HEAD>
<BODY>
<H2>Select Tests: JavaScript Add/Remove</H2>
<TABLE BORDER=1>
<TR>
<TH>Ignore Me</TH>
<TD>
<B>Steps:</B> Test instructions not here yet.<BR>
<B>Verify:</B> Use your imagination.
</TD>
</TR>
</TABLE>
<BR>
<FORM NAME=mainform>
<INPUT TYPE=checkbox NAME=addSelected SELECTED> Add options as selected<BR>
<INPUT TYPE=reset><BR><BR>
<H2>Add/Remove</H2>
<TABLE BORDER=1
<TR>
<TH></TH><TH>Nothing To Start</TH><TH>Nonselected To Start</TH><TH>Selected To Start</TH>
</TR>
<TR>
<TH>Multiple</TH>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah MULTIPLE SIZE=10>
</SELECT>
</TD>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah2)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah2)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah2)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah2)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah2)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah2)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah2)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah2)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah2)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah2)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah2)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah2)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah2)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah2)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah2)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah2 MULTIPLE SIZE=10>
<OPTION VALUE=1>1
<OPTION VALUE=2>2
</SELECT>
</TD>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah3)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah3)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah3)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah3)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah3)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah3)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah3)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah3)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah3)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah3)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah3)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah3)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah3)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah3)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah3)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah3 MULTIPLE SIZE=10>
<OPTION VALUE=1>1
<OPTION VALUE=2 SELECTED>2
</SELECT>
</TD>
</TR>
<TR>
<TH>Single+Size</TH>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah4)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah4)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah4)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah4)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah4)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah4)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah4)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah4)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah4)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah4)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah4)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah4)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah4)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah4)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah4)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah4 SIZE=10>
</SELECT>
</TD>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah5)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah5)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah5)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah5)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah5)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah5)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah5)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah5)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah5)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah5)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah5)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah5)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah5)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah5)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah5)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah5 SIZE=10>
<OPTION VALUE=1>1
<OPTION VALUE=2>2
</SELECT>
</TD>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah6)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah6)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah6)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah6)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah6)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah6)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah6)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah6)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah6)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah6)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah6)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah6)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah6)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah6)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah6)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah6 SIZE=10>
<OPTION VALUE=1>1
<OPTION VALUE=2 SELECTED>2
</SELECT>
</TD>
</TR>
<TR>
<TH>Dropdown</TH>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah7)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah7)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah7)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah7)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah7)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah7)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah7)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah7)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah7)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah7)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah7)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah7)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah7)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah7)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah7)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah7>
</SELECT>
</TD>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah8)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah8)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah8)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah8)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah8)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah8)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah8)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah8)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah8)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah8)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah8)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah8)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah8)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah8)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah8)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah8>
<OPTION VALUE=1>1
<OPTION VALUE=2>2
</SELECT>
</TD>
<TD>
<INPUT TYPE=button onClick="add1(document.mainform.blah9)" VALUE="add(beginning)">
<INPUT TYPE=button onClick="add2(document.mainform.blah9)" VALUE="add(second)">
<INPUT TYPE=button onClick="add3(document.mainform.blah9)" VALUE="add(end)"><BR>
<INPUT TYPE=button onClick="add4(document.mainform.blah9)" VALUE="insertBefore(beginning)">
<INPUT TYPE=button onClick="add5(document.mainform.blah9)" VALUE="replaceChild(second)">
<INPUT TYPE=button onClick="add6(document.mainform.blah9)" VALUE="appendChild()"><BR>
<INPUT TYPE=button onClick="remove1(document.mainform.blah9)" VALUE="remove(beginning)">
<INPUT TYPE=button onClick="remove2(document.mainform.blah9)" VALUE="remove(second)">
<INPUT TYPE=button onClick="remove3(document.mainform.blah9)" VALUE="remove(end)"><BR>
<INPUT TYPE=button onClick="remove4(document.mainform.blah9)" VALUE="removeChild(beginning)">
<INPUT TYPE=button onClick="setInner(document.mainform.blah9)" VALUE="innerHTML = "><BR>
<INPUT TYPE=button onClick="addOptGroup(document.mainform.blah9)" VALUE="add(optgroup)">
<INPUT TYPE=button onClick="addOptGroup2(document.mainform.blah9)" VALUE="add(optgroup) 2"><BR>
<INPUT TYPE=button onClick="showValues(document.mainform.blah9)" VALUE="Show Values">
<INPUT TYPE=button onClick="showSelectedIndex(document.mainform.blah9)" VALUE="Show Selected Index"><BR><BR>
<SELECT NAME=blah9>
<OPTION VALUE=1>1
<OPTION VALUE=2 SELECTED>2
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>

Просмотреть файл

@ -0,0 +1,107 @@
<HTML>
<HEAD>
<TITLE>Select Tests: OnChange</TITLE>
<BODY>
<H2>Select Tests: OnChange</H2>
<TABLE BORDER=1>
<TR>
<TH>JavaScript</TH>
<TD>
<B>Steps:</B> Click each of the buttons in turn.<BR>
<B>Verify:</B> Make sure an alert does not pop up.
</TD>
<TR>
<TH>Click, Keyboard</TH>
<TD>
<B>Steps:</B> Click, hit left/right/up/down/home/end and use SHIFT and CTRL in combination.<BR>
<B>Verify:</B> That an alert pops up each time you
</TD>
</TR>
<TR>
<TH>Drag</TH>
<TD>
<B>Steps:</B> Drag the mouse across multiple options.<BR>
<B>Verify:</B> That an alert pops up only when you finish dragging.
</TD>
</TR>
<TR>
<TH>Cancel Dropdown</TH>
<TD>
<B>Steps:</B> Click the dropdown, and then press ESC or click outside the combobox.<BR>
<B>Verify:</B> onChange should not fire.
</TD>
</TR>
<TR>
<TH>Reset</TH>
<TD>
<B>Steps:</B> Change values in various selects, and hit Reset.<BR>
<B>Verify:</B> onChange should not fire.
</TD>
</TR>
</TABLE>
<BR>
<FORM NAME=mainform>
<INPUT TYPE=button onClick="document.mainform.blah.value = 4" VALUE="Set select.value = 4"><BR>
<INPUT TYPE=button onClick="document.mainform.blah.selectedIndex = 5" VALUE="Set select.selectedIndex = 5"><BR>
<INPUT TYPE=button onClick="document.mainform.blah.options[6].selected = true" VALUE="Set options[6].selected"><BR>
<INPUT TYPE=reset><BR><BR>
<TABLE BORDER=1
<TR>
<TD VALIGN=top>
<H3>Multiple select</H3>
<SELECT NAME=blah MULTIPLE SIZE=10 onChange="alert('Multiselect changed to ' + document.mainform.blah.value)">
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION VALUE=4>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD VALIGN=top>
<H3>Single select</H3>
<SELECT NAME=blah2 SIZE=10 onChange="alert('Single select changed to ' + document.mainform.blah2.value)">
<OPTION>1
<OPTION>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
<TD VALIGN=top>
<H3>Dropdown</H3>
<SELECT NAME=blah3 onChange="alert('Dropdown changed to ' + document.mainform.blah3.value)">
<OPTION>1
<OPTION SELECTED>2
<OPTION>3
<OPTION>4
<OPTION>5
<OPTION>6
<OPTION>7
<OPTION>8
<OPTION>9
<OPTION>10
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>