Navigation Menu

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

Screen orientation: event firing and promise resolving #15729

Merged
merged 7 commits into from Mar 14, 2019

Conversation

Johanna-hub
Copy link
Contributor

@Johanna-hub Johanna-hub commented Mar 7, 2019

screen-orientation/lock-unlock-check.html Outdated Show resolved Hide resolved
screen-orientation/lock-unlock-check.html Show resolved Hide resolved
screen-orientation/lock-unlock-check.html Outdated Show resolved Hide resolved
const pMustReject = screen.orientation.lock("landscape");
const pMustResolve = new Promise(r => {
screen.orientation.onchange = async () => {
screen.orientation.unlock();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we have a spec bug 🙌 The spec doesn't seem to say what to do with the pMustReject promise when .unlock() is called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's true!

});
await promise_rejects(t, new TypeError(), pMustReject);
await pMustResolve;
}, "Event must fire before orientationPendingPromise resolves");
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure the tested assertion here is unique too... it should have something to do with .unlock() and orientationPendingPromise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried to word both, not sure if I've captured it right though.

@haoxli haoxli removed their request for review March 14, 2019 08:36
@marcoscaceres marcoscaceres merged commit 7176f30 into web-platform-tests:master Mar 14, 2019
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
import { getOppositeOrientation } from "/screen-orientation/resources/orientation-utils.js";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is supposed to throw an early SyntaxError, as static import only works within <script type=module>, so the rest of the <script> is essentially ignored. This seems like a broken test? cc @LeszekSwirski

Copy link
Contributor

Choose a reason for hiding this comment

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

Filed here #17547

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @mathiasbynens! how weird... I thought we had these working but you are absolutely right that these would be syntax errors :/

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.

None yet

4 participants