mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Rename original window_resizeTo.html
to window_resize_event.html
& Fix wrong usage of innerHeight
& add new test (#37856)
1. rename original `window_resizeTo.html` to `window_resize_event.html` to reflect the purpose. Also change {innerWidth, innerHeight} to {outerWidth, outerHeight} to match spec. 2. Add a new test `window_resizeTo.html` for https://github.com/servo/servo/pull/37848 Testing: new test always fails because of https://github.com/servo/servo/issues/37824, which gives inaccurate outerHeight. Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
19ceccc8eb
commit
a81ddd5c18
4 changed files with 41 additions and 13 deletions
9
tests/wpt/mozilla/meta/MANIFEST.json
vendored
9
tests/wpt/mozilla/meta/MANIFEST.json
vendored
|
@ -14430,7 +14430,14 @@
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"window_resizeTo.html": [
|
"window_resizeTo.html": [
|
||||||
"3f6c5a610d52b64bf4457d478b929e95d79e9ab8",
|
"d104be2bc840eecc7c32e27a6fdf1850d945f1e5",
|
||||||
|
[
|
||||||
|
null,
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"window_resize_event.html": [
|
||||||
|
"68222f978909022ae1abfbdce6c4ea1c5787c554",
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
{}
|
{}
|
||||||
|
|
3
tests/wpt/mozilla/meta/mozilla/window_resizeTo.html.ini
vendored
Normal file
3
tests/wpt/mozilla/meta/mozilla/window_resizeTo.html.ini
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[window_resizeTo.html]
|
||||||
|
[Correctly resize outerWidth and outerHeight]
|
||||||
|
expected: FAIL
|
|
@ -1,21 +1,18 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Verify that the resize event is fired when the window is resized (in popup)</title>
|
<title>Verify that the resize dimension is outerWidth & outerHeight</title>
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script>
|
<script>
|
||||||
async_test(function (t) {
|
promise_test(async (t) => {
|
||||||
var popup = window.open("about:blank", "_blank", "width=100,height=100");
|
const popup = window.open("about:blank", "_blank", "width=100,height=100");
|
||||||
assert_not_equals(popup, null, "Popup must be successfully opened");
|
assert_not_equals(popup, null, "Popup must be successfully opened");
|
||||||
|
|
||||||
popup.onload = function () {
|
popup.resizeTo(200, 200);
|
||||||
popup.onresize = t.step_func(function () {
|
// wait briefly for resize to complete
|
||||||
assert_approx_equals(popup.innerWidth, 200, 10, "Popup width should be ~200");
|
await new Promise(resolve => setTimeout(resolve, 100));
|
||||||
assert_approx_equals(popup.innerHeight, 200, 10, "Popup height should be ~200");
|
|
||||||
t.done();
|
|
||||||
});
|
|
||||||
|
|
||||||
popup.resizeTo(200, 200);
|
assert_approx_equals(popup.outerWidth, 200, 10, "Popup width should be ~200");
|
||||||
};
|
assert_approx_equals(popup.outerHeight, 200, 10, "Popup height should be ~200");
|
||||||
}, "Popup onresize event fires after resizeTo");
|
}, "Correctly resize outerWidth and outerHeight");
|
||||||
</script>
|
</script>
|
||||||
|
|
21
tests/wpt/mozilla/tests/mozilla/window_resize_event.html
vendored
Normal file
21
tests/wpt/mozilla/tests/mozilla/window_resize_event.html
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Verify that the resize event is fired when the window is resized (in popup)</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script>
|
||||||
|
async_test(function (t) {
|
||||||
|
var popup = window.open("about:blank", "_blank", "width=100,height=100");
|
||||||
|
assert_not_equals(popup, null, "Popup must be successfully opened");
|
||||||
|
|
||||||
|
popup.onload = function () {
|
||||||
|
popup.onresize = t.step_func(function () {
|
||||||
|
assert_approx_equals(popup.outerWidth, 200, 10, "Popup width should be ~200");
|
||||||
|
assert_approx_equals(popup.outerHeight, 200, 10, "Popup height should be ~200");
|
||||||
|
t.done();
|
||||||
|
});
|
||||||
|
|
||||||
|
popup.resizeTo(200, 200);
|
||||||
|
};
|
||||||
|
}, "Popup onresize event fires after resizeTo");
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue