html: Add a test for form.requestSubmit()#16743
Merged
Conversation
Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597
3 tasks
zcorpan
requested changes
May 9, 2019
| assert_throws(new TypeError(), () => { | ||
| form.requestSubmit(submitButton); | ||
| }); | ||
| }, 'Passing a submit button not owned by the context object should throw'); |
Member
There was a problem hiding this comment.
The element isn't even in the same tree, here. There are other interesting tests as well.
- The control is a descendant, but has a
formattribute overriding the form owner to a different form. - The control is a descendant, but has a
formattribute that gives the control no form owner (e.g.form="") - The control is a descendant, but is actually owned by a different form by association from the parser. [1] or [2]
For each case, check that A.requestSubmit(control) throws, and B.requestSubmit(control) works.
[1] nested form actually owns the control
<!DOCTYPE html>
<form action=data:,A>
<div>
</form>
<form action=data:,B>
<input type=submit>
</form>
</div>
[2] the control is a descendant of the A form, not the B form, but is actually owned by B
<!DOCTYPE html>
<form action=data:,A>
<table>
</form>
<form action=data:,B>
<tr><td><input type=submit></td></tr>
</form>
</table>
Contributor
Author
There was a problem hiding this comment.
This is not a test of .form IDL attribute, and IMO testing various patterns of .form here isn't cost-effective. I added a few cases which ensures UAs don't apply simple ancestor check.
Member
|
whatwg/html#4597 (comment) also seems interesting to test |
Contributor
Author
Added testcases based on whatwg/html#4621 . |
zcorpan
approved these changes
May 15, 2019
domenic
added a commit
to whatwg/html
that referenced
this pull request
May 16, 2019
Closes #4187. Tests: web-platform-tests/wpt#16743.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Specification issue: whatwg/html#4187
Specification PR: whatwg/html#4597