Bug 1607681 [wpt PR 21080] - Added two rendering tests for color-scheme:dark., a=testonly

Automatic update from web-platform-tests
Added two rendering tests for color-scheme:dark.

The background for an iframe is transparent, even with a dark
color-scheme. Also, test that the computed style on the root element is
transparent with a dark color-scheme.

These tests need to be run with a preferred color-scheme of dark in
order to have a used value of dark. A helper stylesheet is used to
enforce that.

Bug: 939811
Change-Id: I9fb3db1c694b1830865d31cef494636f3a2d43c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1989535
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729283}

--

wpt-commits: 6a2c9b9b36786def004a69ae8e0b79eaeee3ff3e
wpt-pr: 21080
This commit is contained in:
Rune Lillesveen 2020-01-08 13:19:12 +00:00 коммит произвёл moz-wptsync-bot
Родитель f553e8b9c9
Коммит d76ababb1e
6 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,3 @@
<!doctype html>
<title>CSS Test Reference</title>
<iframe width="600" height="400" src="support/dark-frame-ref.html"></iframe>

Просмотреть файл

@ -0,0 +1,6 @@
<!doctype html>
<title>CSS Color Adjustment Test: Frames with a dark color-scheme should still be transparent</title>
<link rel="help" href="https://drafts.csswg.org/css-color-adjust/#color-scheme-processing">
<link rel="match" href="color-scheme-iframe-background-ref.html">
<link rel="stylesheet" href="support/assert-preferred-dark.css">
<iframe width="600" height="400" src="support/dark-frame.html"></iframe>

Просмотреть файл

@ -0,0 +1,15 @@
<!doctype html>
<title>CSS Color Adjustment Test: color-scheme does not affect :root background</title>
<link rel="help" href="https://drafts.csswg.org/css-color-adjust/#color-scheme-processing">
<link rel="stylesheet" href="support/assert-preferred-dark.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
:root { color-scheme: dark }
</style>
<body></body>
<script>
test(() => {
assert_equals(getComputedStyle(document.documentElement).backgroundColor, "rgba(0, 0, 0, 0)");
}, "Root element background should be transparent for dark color-scheme.");
</script>

Просмотреть файл

@ -0,0 +1,9 @@
@media not all and (prefers-color-scheme: dark) {
:root {
background-color: red !important;
}
body::before {
font-size: 64px;
content: "Test must be run with preferred dark color scheme.";
}
}

Просмотреть файл

@ -0,0 +1,5 @@
<!doctype html>
<style>
p { color: green }
</style>
<p>This text should be green and the background should be the same as the top document.</p>

Просмотреть файл

@ -0,0 +1,6 @@
<!doctype html>
<style>
:root { color-scheme: dark }
p { color: green }
</style>
<p>This text should be green and the background should be the same as the top document.</p>