blob: f98494a950719ef94d8b91f525659cb68682d813 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<!DOCTYPE html>
<html lang="en">
<title>HTMLSelectListElement Test: form state restore</title>
<link rel="author" title="Ionel Popescu" href="mailto:iopopesc@microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<input id="emptyOnFirstVisit">
<form action="support/back.html" id="form0">
<selectlist id="selectlist0">
<option>one</option>
<option>two</option>
<option>three</option>
</selectlist>
</form>
<script>
async_test(t => {
window.onload = () => t.step_timeout(() => {
let state = document.getElementById('emptyOnFirstVisit');
let selectList = document.getElementById("selectlist0");
if (!state.value) {
// First visit.
t.step_timeout(() => {
state.value = 'visited';
assert_equals(selectList.value, "one");
selectList.value = "two";
// The form is submitted in a timeout to make sure that a new back/forward list item is created.
document.getElementById('form0').submit();
}, 0);
} else {
// Went back to this page again, and the form state should be restored.
assert_equals(selectList.value, "two");
t.done();
}
}, 1);
}, "Test restoring state after form submission");
</script>
|