gecko-dev/toolkit/components/passwordmgr/test/test_basic_form_3pw_1.html

181 строка
6.7 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test for Login Manager</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Login Manager test: forms with 3 password fields (form filling)
<p id="display"></p>
<div id="content" style="display: none">
<p>The next three forms are <b>user/pass/passB/passC</b>, as all-empty, preuser(only), and preuser/pass</p>
<form id="form1" action="formtest.js">
<input type="text" name="uname">
<input type="password" name="pword">
<input type="password" name="qword">
<input type="password" name="rword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<form id="form2" action="formtest.js">
<input type="text" name="uname" value="testuser">
<input type="password" name="pword">
<input type="password" name="qword">
<input type="password" name="rword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<form id="form3" action="formtest.js">
<input type="text" name="uname" value="testuser">
<input type="password" name="pword" value="testpass">
<input type="password" name="qword">
<input type="password" name="rword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<p>The next three forms are <b>user/passB/pass/passC</b>, as all-empty, preuser(only), and preuser/pass</p>
<form id="form4" action="formtest.js">
<input type="text" name="uname">
<input type="password" name="qword">
<input type="password" name="pword">
<input type="password" name="rword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<form id="form5" action="formtest.js">
<input type="text" name="uname" value="testuser">
<input type="password" name="qword">
<input type="password" name="pword">
<input type="password" name="rword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<form id="form6" action="formtest.js">
<input type="text" name="uname" value="testuser">
<input type="password" name="qword">
<input type="password" name="pword" value="testpass">
<input type="password" name="rword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<p>The next three forms are <b>user/passB/passC/pass</b>, as all-empty, preuser(only), and preuser/pass</p>
<form id="form7" action="formtest.js">
<input type="text" name="uname">
<input type="password" name="qword">
<input type="password" name="rword">
<input type="password" name="pword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<form id="form8" action="formtest.js">
<input type="text" name="uname" value="testuser">
<input type="password" name="qword">
<input type="password" name="rword">
<input type="password" name="pword">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
<form id="form9" action="formtest.js">
<input type="text" name="uname" value="testuser">
<input type="password" name="qword">
<input type="password" name="rword">
<input type="password" name="pword" value="testpass">
<button type="submit">Submit</button>
<button type="reset"> Reset </button>
</form>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Login Manager: form fill, 3 password fields **/
commonInit();
// Test to make sure 3-password forms are filled properly.
function startTest() {
// Check form 1
is($_(1, "uname").value, "testuser", "Checking username 1");
is($_(1, "pword").value, "testpass", "Checking password 1");
is($_(1, "qword").value, "", "Checking password 1 (q)");
is($_(1, "rword").value, "", "Checking password 1 (r)");
// Check form 2
is($_(2, "uname").value, "testuser", "Checking username 2");
is($_(2, "pword").value, "testpass", "Checking password 2");
is($_(2, "qword").value, "", "Checking password 2 (q)");
is($_(2, "rword").value, "", "Checking password 2 (r)");
// Check form 3
is($_(3, "uname").value, "testuser", "Checking username 3");
is($_(3, "pword").value, "testpass", "Checking password 3");
is($_(3, "qword").value, "", "Checking password 3 (q)");
is($_(3, "rword").value, "", "Checking password 3 (r)");
// Check form 4
is($_(4, "uname").value, "testuser", "Checking username 4");
todo_is($_(4, "qword").value, "", "Checking password 4 (q)");
todo_is($_(4, "pword").value, "testpass", "Checking password 4");
is($_(4, "rword").value, "", "Checking password 4 (r)");
// Check form 5
is($_(5, "uname").value, "testuser", "Checking username 5");
todo_is($_(5, "qword").value, "", "Checking password 5 (q)");
todo_is($_(5, "pword").value, "testpass", "Checking password 5");
is($_(5, "rword").value, "", "Checking password 5 (r)");
// Check form 6
is($_(6, "uname").value, "testuser", "Checking username 6");
todo_is($_(6, "qword").value, "", "Checking password 6 (q)");
is($_(6, "pword").value, "testpass", "Checking password 6");
is($_(6, "rword").value, "", "Checking password 6 (r)");
// Check form 7
is($_(7, "uname").value, "testuser", "Checking username 7");
todo_is($_(7, "qword").value, "", "Checking password 7 (q)");
is($_(7, "rword").value, "", "Checking password 7 (r)");
todo_is($_(7, "pword").value, "testpass", "Checking password 7");
// Check form 8
is($_(8, "uname").value, "testuser", "Checking username 8");
todo_is($_(8, "qword").value, "", "Checking password 8 (q)");
is($_(8, "rword").value, "", "Checking password 8 (r)");
todo_is($_(8, "pword").value, "testpass", "Checking password 8");
// Check form 9
is($_(9, "uname").value, "testuser", "Checking username 9");
todo_is($_(9, "qword").value, "", "Checking password 9 (q)");
is($_(9, "rword").value, "", "Checking password 9 (r)");
is($_(9, "pword").value, "testpass", "Checking password 9");
// TODO: as with the 2-password cases, add tests to check for creating new
// logins and changing passwords.
SimpleTest.finish();
}
window.onload = startTest;
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>