Skip to content

[css-shapes] Refactor tests#19921

Merged
foolip merged 1 commit intoweb-platform-tests:masterfrom
bocoup:single-test-opt-in-css-shapes
Oct 27, 2019
Merged

[css-shapes] Refactor tests#19921
foolip merged 1 commit intoweb-platform-tests:masterfrom
bocoup:single-test-opt-in-css-shapes

Conversation

@jugglinmike
Copy link
Contributor

@jugglinmike jugglinmike commented Oct 26, 2019

testharness.js was recently extended with an API to explicitly opt-in to
the "single page test" feature [1]. As per WPT RFC 28 [2], tests which
do not use this API and which do not declare any subtests will soon be
reported as a harness error.

Update some tests which previously opted in implicitly to use the new
API. Update others to instead declare a single subtest (so that they are
no longer single-page tests).

[1] #19449
[2] https://github.com/web-platform-tests/rfcs/blob/master/rfcs/single_test.md

Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

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

My suggestions here are borderline what's reasonable to ask for on this cleanup PR, as the problems I point to were pre-existing. So please push back if you disagree.

</div>
<div id="log"></div>
<script>
setup({ single_test: true });
Copy link
Member

Choose a reason for hiding this comment

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

verifyTextPoints is synchronous, can you remove the done() call from it and just wrap this in test(() => {}) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. As long as we're refactoring (and in keeping with the spirit of your suggestion), I've also moved the assertion into the test body.

Copy link
Member

Choose a reason for hiding this comment

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

I think it would have been fine to leave it in the helper and that would have made the call sites look a bit simpler, but sure, there is a consistency to extracting that too.

<script src="/resources/testharnessreport.js"></script>
<script src="support/spec-example-utils.js"></script>
<script>
setup({ single_test: true });
Copy link
Member

Choose a reason for hiding this comment

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

approxShapeTest is also sync, but there's the onload="checkFloats();" bit below which makes the suggestion for verifyTextPoints unworkable. Instead, can you just pull the done() call into the test, after the approxShapeTest call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure can

@jugglinmike jugglinmike force-pushed the single-test-opt-in-css-shapes branch from 356a548 to 59222a1 Compare October 27, 2019 18:25
@jugglinmike jugglinmike changed the title [css-shapes] Opt-in to single-page test feature [css-shapes] Refactor tests Oct 27, 2019
testharness.js was recently extended with an API to explicitly opt-in to
the "single page test" feature [1]. As per WPT RFC 28 [2], tests which
do not use this API and which do not declare any subtests will soon be
reported as a harness error.

Update some tests which previously opted in implicitly to use the new
API. Update others to instead declare a single subtest (so that they are
no longer single-page tests).

[1] web-platform-tests#19449
[2] https://github.com/web-platform-tests/rfcs/blob/master/rfcs/single_test.md
@jugglinmike jugglinmike force-pushed the single-test-opt-in-css-shapes branch from 59222a1 to 9168a23 Compare October 27, 2019 18:29
@jugglinmike
Copy link
Contributor Author

Since the commit message would no longer describe this solution, I've amended the proposed commit and force-pushed the result to this branch. The original version of this branch is available here.

@foolip foolip merged commit e6c0391 into web-platform-tests:master Oct 27, 2019
@jugglinmike

This comment has been minimized.

@jugglinmike
Copy link
Contributor Author

My previous comment was intended for gh-19928. Sorry for the confusion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants