Skip to content

Commit b8263dc

Browse files
authored
Add descriptions to fullscreen asserts (#50625)
This is to make it easier to understand failures.
1 parent 2f889e1 commit b8263dc

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

fullscreen/model/remove-first.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@
2222
trusted_request(first),
2323
fullScreenChange(),
2424
]);
25-
assert_equals(document.fullscreenElement, first);
26-
assert_equals(firstEvent.target, first);
25+
assert_equals(document.fullscreenElement, first, "fullscreen element after first request");
26+
assert_equals(firstEvent.target, first, "first fullscreenchange event target");
2727

2828
const last = document.getElementById("last");
2929
const [, secondEvent] = await Promise.all([
3030
trusted_request(last),
3131
fullScreenChange(),
3232
]);
33-
assert_equals(document.fullscreenElement, last);
34-
assert_equals(event.target, last);
33+
assert_equals(document.fullscreenElement, last, "fullscreen element after second request");
34+
assert_equals(secondEvent.target, last, "second fullscreenchange event target");
3535
first.remove();
3636

3737
// Both /first/ and /last/ were removed from the top layer and
3838
// thus the fullscreen element synchronously becomes null.
39-
assert_equals(document.fullscreenElement, null);
39+
assert_equals(document.fullscreenElement, null, "fullscreen element immediately after removal");
4040

4141
const thirdEvent = await fullScreenChange();
42-
assert_equals(document.fullscreenElement, null);
43-
assert_equals(event.target, document);
42+
assert_equals(document.fullscreenElement, null, "fullscreen element after third event");
43+
assert_equals(thirdEvent.target, document, "third fullscreenchange event target");
4444
});
4545
</script>

fullscreen/model/remove-last.html

+13-13
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@
2222
fullScreenChange(),
2323
]);
2424

25-
assert_equals(document.fullscreenElement, first);
26-
assert_equals(firstEvent.target, first);
25+
assert_equals(document.fullscreenElement, first, "fullscreen element after first request");
26+
assert_equals(firstEvent.target, first, "first fullscreenchange event target");
2727

2828
const last = document.getElementById("last");
29-
const [, lastEvent] = await Promise.all([
29+
const [, secondEvent] = await Promise.all([
3030
trusted_request(last),
3131
fullScreenChange(),
3232
]);
3333

34-
assert_equals(document.fullscreenElement, last);
35-
assert_equals(event.target, last);
34+
assert_equals(document.fullscreenElement, last, "fullscreen element after second request");
35+
assert_equals(secondEvent.target, last, "second fullscreenchange event target");
3636
last.remove();
37-
// Because /last/ was removed from the top layer, we exit
38-
// fullscreen element synchronously.
39-
assert_equals(document.fullscreenElement, first);
37+
// Although /last/ was removed from the top layer synchronously, /first/ remains
38+
// and becomes the new fullscreen element.
39+
assert_equals(document.fullscreenElement, first, "fullscreen element immediately after removal");
4040

41-
const finalEvent = await fullScreenChange();
42-
// fullscreen change element should be queued against the
43-
// document target.
44-
assert_equals(document.fullscreenElement, null);
45-
assert_equals(event.target, document);
41+
// The removal of the fullscreen element triggers exiting fullscreen, but those changes
42+
// happen async when the event is fired.
43+
const thirdEvent = await fullScreenChange();
44+
assert_equals(document.fullscreenElement, null, "fullscreen element after third event");
45+
assert_equals(thirdEvent.target, document, "third fullscreenchange event target");
4646
});
4747
</script>

0 commit comments

Comments
 (0)