|
| 1 | +<!DOCTYPE html> |
| 2 | +<link rel=author href="mailto:lwarlow@igalia.com"> |
| 3 | +<script src="../../../../resources/testharness.js"></script> |
| 4 | +<script src="../../../../resources/testharnessreport.js"></script> |
| 5 | + |
| 6 | +<iframe name=foo></iframe> |
| 7 | +<form id="form" target=foo action="about:blank"> |
| 8 | + <button id=reset-in-form type=reset commandfor=mypopover command=toggle-popover>reset</button> |
| 9 | + <button id=submit-in-form type=submit commandfor=mypopover command=toggle-popover>submit</button> |
| 10 | + <button id=button-in-form type=button commandfor=mypopover command=toggle-popover>type=button</button> |
| 11 | + <button id=invalid-in-form type=invalid commandfor=mypopover command=toggle-popover>invalid</button> |
| 12 | + <button id=missing-in-form commandfor=mypopover command=toggle-popover>missing</button> |
| 13 | + <button id=missing-in-form-command-only command=toggle-popover>missing with command only</button> |
| 14 | + <button id=missing-in-form-commandfor-only commandfor=mypopover >missing with commandfor only</button> |
| 15 | +</form> |
| 16 | + |
| 17 | +<button id=reset-attr-form type=reset commandfor=mypopover command=toggle-popover form=form>reset</button> |
| 18 | +<button id=submit-attr-form type=submit commandfor=mypopover command=toggle-popover form=form>submit</button> |
| 19 | +<button id=button-attr-form type=button commandfor=mypopover command=toggle-popover form=form>type=button</button> |
| 20 | +<button id=invalid-attr-form type=invalid commandfor=mypopover command=toggle-popover form=form>invalid</button> |
| 21 | +<button id=missing-attr-form commandfor=mypopover command=toggle-popover form=form>missing</button> |
| 22 | +<button id=missing-attr-form-command-only command=toggle-popover form=form>missing with command only</button> |
| 23 | +<button id=missing-attr-form-commandfor-only commandfor=mypopover form=form>missing with commandfor only</button> |
| 24 | + |
| 25 | +<button id=reset-outside-form type=reset commandfor=mypopover command=toggle-popover>reset</button> |
| 26 | +<button id=submit-outside-form type=submit commandfor=mypopover command=toggle-popover>submit</button> |
| 27 | +<button id=button-outside-form type=button commandfor=mypopover command=toggle-popover>type=button</button> |
| 28 | +<button id=invalid-outside-form type=invalid commandfor=mypopover command=toggle-popover>invalid</button> |
| 29 | +<button id=missing-outside-form commandfor=mypopover command=toggle-popover>missing</button> |
| 30 | +<button id=missing-outside-form-command-only command=toggle-popover>missing with command only</button> |
| 31 | +<button id=missing-outside-form-commandfor-only commandfor=mypopover>missing with commandfor only</button> |
| 32 | + |
| 33 | +<script> |
| 34 | +const data = { |
| 35 | + 'reset-in-form': 'reset', |
| 36 | + 'submit-in-form': 'submit', |
| 37 | + 'button-in-form': 'button', |
| 38 | + 'invalid-in-form': 'submit', |
| 39 | + 'missing-in-form': 'button', |
| 40 | + 'missing-in-form-command-only': 'button', |
| 41 | + 'missing-in-form-commandfor-only': 'button', |
| 42 | + 'reset-attr-form': 'reset', |
| 43 | + 'submit-attr-form': 'submit', |
| 44 | + 'button-attr-form': 'button', |
| 45 | + 'invalid-attr-form': 'submit', |
| 46 | + 'missing-attr-form': 'button', |
| 47 | + 'missing-attr-form-command-only': 'button', |
| 48 | + 'missing-attr-form-commandfor-only': 'button', |
| 49 | + 'reset-outside-form': 'reset', |
| 50 | + 'submit-outside-form': 'submit', |
| 51 | + 'button-outside-form': 'button', |
| 52 | + 'invalid-outside-form': 'submit', |
| 53 | + 'missing-outside-form': 'button', |
| 54 | + 'missing-outside-form-command-only': 'button', |
| 55 | + 'missing-outside-form-commandfor-only': 'button', |
| 56 | +}; |
| 57 | + |
| 58 | +Object.entries(data).map(([id, expectedType]) => { |
| 59 | + test(() => { |
| 60 | + const button = document.getElementById(id); |
| 61 | + assert_equals(button.type, expectedType, `type of ${id} should be ${expectedType}`); |
| 62 | + }, `Button with id ${id} should reflect type correctly`); |
| 63 | +}); |
| 64 | +</script> |
0 commit comments