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

DOM: add tests for AbortSignal.reason #31291

Merged
merged 7 commits into from
Nov 8, 2021

Conversation

nidhijaju
Copy link
Member

Add tests for AbortSignal's new abort reason property.

See whatwg/dom#1027 for accompanying spec change.

@yutakahirano
Copy link
Contributor

Can you add descriptions to assertions? Descriptions don't have to be long (I feel "signal reason should be set when controller is aborted" is a bit too long). Assertion description is useful to find the failed assertion in a test, so it can be anything as long as it is unique in the test.

So the first test case can be:

  ...
  assert_true(signal.aborted, "signal.abort");
  assert_equals(signal.reason, reason, "signal.reason");

@nidhijaju
Copy link
Member Author

Makes sense! I've added assertion descriptions to my tests based on your suggestion.

@nidhijaju
Copy link
Member Author

@annevk Is it okay if you also take a look to see if the tests in this PR look okay to you?

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

I recommend running the tests even if they will fail to spot syntax errors and such.

dom/abort/event.any.js Outdated Show resolved Hide resolved
dom/abort/event.any.js Outdated Show resolved Hide resolved
dom/abort/event.any.js Show resolved Hide resolved
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

For the new tests it seems good to assert some fields before calling abort() as well. At least once. E.g., assert_true("reason" in signal) and assert_equals(signal.reason, undefined).

dom/abort/event.any.js Outdated Show resolved Hide resolved
Copy link
Contributor

@yutakahirano yutakahirano left a comment

Choose a reason for hiding this comment

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

LGTM.

@annevk annevk merged commit 9c7dfd2 into web-platform-tests:master Nov 8, 2021
@nidhijaju nidhijaju deleted the abortreason-tests branch November 9, 2021 07:05
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.

4 participants