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

Add WPT for overlay user-agent rules #40171

Merged
merged 1 commit into from
May 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions css/css-position/overlay/overlay-user-agent-rules.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://github.com/whatwg/html/pull/9093">
<link rel=help href="https://drafts.csswg.org/css-position-4/#overlay">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<title>CSS Position Test: User agent style for overlay</title>

<style>
div {
overlay: auto;
}
</style>

<body>
<script>
test(() => {
const div = document.createElement('div');
document.body.appendChild(div);
div.style.overlay = 'auto';
assert_equals(getComputedStyle(div).overlay, 'none');
}, 'HTML elements should have overlay:none !important from the user-agent.');

test(() => {
const svg = document.createElement('svg');
document.body.appendChild(svg);
svg.style.overlay = 'auto';
assert_equals(getComputedStyle(svg).overlay, 'none');
}, 'SVG elements should have overlay:none !important from the user-agent.');

test(() => {
const nullNamespace = document.createElementNS(null, 'div');
document.body.appendChild(nullNamespace);
assert_equals(getComputedStyle(nullNamespace).overlay, 'none');
}, 'Null namespace elements should have overlay:none !important from the user-agent.');

test(() => {
const weirdNamespace = document.createElementNS('hello world', 'div');
document.body.appendChild(weirdNamespace);
assert_equals(getComputedStyle(weirdNamespace).overlay, 'none');
}, 'Arbitrary namespace elements should have overlay:none !important from the user-agent.');
</script>