diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-form-state-restore.tentative.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-form-state-restore.tentative.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-form-state-restore.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-form-state-restore.tentative.html new file mode 100644 index 0000000000..f98494a950 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-form-state-restore.tentative.html @@ -0,0 +1,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> |