mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
style: Support calc() in color functions.
This commit is contained in:
parent
e91c9ec7fe
commit
23d69ea77d
7 changed files with 230 additions and 72 deletions
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Test: calc() function in <color></title>
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values/#funcdef-calc">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="testNode"></div>
|
||||
<script>
|
||||
const div = document.querySelector("#testNode");
|
||||
const TESTS = {
|
||||
// specified -> expected
|
||||
"rgb(calc(0), calc(255 + 0), calc(140 - 139 - 1))": "rgb(0, 255, 0)",
|
||||
"rgba(calc(0%) calc(100%) calc(0%) / calc(10% * 10))": "rgb(0, 255, 0)",
|
||||
"hsl(calc(5deg * (360 / 5)), calc(10% * 10), calc(10% * 10))": "rgb(255, 255, 255)"
|
||||
}
|
||||
|
||||
test(function() {
|
||||
for (let test in TESTS) {
|
||||
div.style.backgroundColor = "";
|
||||
div.style.backgroundColor = test;
|
||||
assert_equals(getComputedStyle(div).backgroundColor, TESTS[test], test);
|
||||
}
|
||||
}, "calc() in color functions");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue