Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html: Add a test for form.requestSubmit() #16743

Merged
merged 3 commits into from May 16, 2019
Merged

html: Add a test for form.requestSubmit() #16743

merged 3 commits into from May 16, 2019

Conversation

tkent-google
Copy link
Contributor

Specification issue: whatwg/html#4187
Specification PR: whatwg/html#4597

@wpt-pr-bot wpt-pr-bot added the html label May 9, 2019
@tkent-google tkent-google changed the title Add a test for form.requestSubmit() html: Add a test for form.requestSubmit() May 9, 2019
assert_throws(new TypeError(), () => {
form.requestSubmit(submitButton);
});
}, 'Passing a submit button not owned by the context object should throw');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 form attribute overriding the form owner to a different form.
  • The control is a descendant, but has a form attribute 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>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@zcorpan
Copy link
Member

zcorpan commented May 9, 2019

whatwg/html#4597 (comment) also seems interesting to test

@tkent-google
Copy link
Contributor Author

whatwg/html#4597 (comment) also seems interesting to test

Added testcases based on whatwg/html#4621 .

@domenic domenic merged commit 1de2d96 into master May 16, 2019
@domenic domenic deleted the tkent-requestSubmit branch May 16, 2019 19:06
domenic added a commit to whatwg/html that referenced this pull request May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants