Skip to content

Commit

Permalink
Add some tests for color-mix() and currentColor.
Browse files Browse the repository at this point in the history
This adds a test that passes and a test that doesn't.

The first one checks that we inherit currentColor correctly. The second
one checks that currentColor is mixed in the right color-space
(bug 1770829).

Differential Revision: https://phabricator.services.mozilla.com/D147107

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1770830
gecko-commit: 658d0c192f719ca04bc7d7c81d3b9fa431d43607
gecko-reviewers: boris
  • Loading branch information
emilio authored and moz-wptsync-bot committed May 26, 2022
1 parent b293894 commit f6b8809
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
11 changes: 11 additions & 0 deletions css/css-color/color-mix-currentcolor-001-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
color: red;
background-color: green;
}
</style>
<div></div>
23 changes: 23 additions & 0 deletions css/css-color/color-mix-currentcolor-001.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<meta charset=utf-8>
<link rel="match" href="color-mix-currentcolor-001-ref.html">
<title>currentColor is inherited correctly in color-mix()</title>
<link rel="help" href="https://drafts.csswg.org/css-color-5/#color-mix">
<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<style>
div {
width: 100px;
height: 100px;
background-color: red;
color: red;
background-color: color-mix(in srgb, currentColor 50%, green);
}
div div {
color: green;
background-color: inherit;
}
</style>
<div>
<div></div>
</div>
11 changes: 11 additions & 0 deletions css/css-color/color-mix-currentcolor-002-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
color: red;
background-color: color-mix(in lch, green 50%, blue);
}
</style>
<div></div>
22 changes: 22 additions & 0 deletions css/css-color/color-mix-currentcolor-002.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<link rel="match" href="color-mix-currentcolor-002-ref.html">
<title>currentColor is mixed with the correct color-space in color-mix()</title>
<link rel="help" href="https://drafts.csswg.org/css-color-5/#color-mix">
<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<style>
div {
width: 100px;
height: 100px;
background-color: red;
color: red;
background-color: color-mix(in lch, currentColor 50%, blue);
}
div div {
color: green;
background-color: inherit;
}
</style>
<div>
<div></div>
</div>

0 comments on commit f6b8809

Please sign in to comment.