<!DOCTYPE html>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<iframe src="resources/form-associated-state-restore-frame.html"></iframe>
<script>
let t = async_test('Form-associated custom elements can restore their values on back-forward navigation');
function doneTest() {
t.step(() => {
let d = document.querySelector('iframe').contentDocument;
assert_equals(d.querySelector('my-control-1').value, 'edit1');
assert_equals(d.querySelector('my-control-1').lastRestoreMode, 'restore');
assert_equals(d.querySelector('my-control-2').value, 'edit2');
assert_equals(d.querySelector('my-control-2').lastRestoreMode, 'restore');
assert_equals(d.querySelector('#control-with-state').value, 'edit8');
assert_equals(d.querySelector('#control-with-state').lastRestoreState, 'edit8/edit8');
assert_equals(d.querySelector('#control-with-state').lastRestoreMode, 'restore');
assert_equals(d.querySelector('#control-with-null-value').value, null);
assert_equals(d.querySelector('#control-with-null-value').lastRestoreState, 'null');
assert_equals(d.querySelector('#control-with-null-value').lastRestoreMode, 'restore');
assert_equals(d.querySelector('#focus').value, 'initial');
assert_equals(d.querySelector('#nested-focus').value, 'initial');
assert_equals(d.querySelector('#disabled').value, 'initial');
assert_equals(d.querySelector('#readonly').value, 'initial');
assert_equals(d.querySelector('#fieldset-disabled').value, 'initial');
t.done();
});
}
</script>
</body>