OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <meta charset="UTF-8"> | |
3 <style> | |
4 .parent { | |
5 --color: blue; | |
6 } | |
7 .target { | |
8 --color: yellow; | |
9 } | |
10 </style> | |
11 <body alink="red" link="blue"> | |
12 <script src="../interpolation/resources/interpolation-test.js"></script> | |
13 <script> | |
14 CSS.registerProperty({ | |
15 name: '--color', | |
16 syntax: '<color>', | |
17 initialValue: 'black', | |
18 }); | |
19 | |
20 assertInterpolation({ | |
21 property: '--color', | |
22 from: neutralKeyframe, | |
23 to: 'green', | |
24 }, [ | |
25 {at: -0.3, is: 'rgb(255, 255, 0)'}, | |
26 {at: 0, is: 'rgb(255, 255, 0)'}, | |
27 {at: 0.3, is: 'rgb(179, 217, 0)'}, | |
28 {at: 0.6, is: 'rgb(102, 179, 0)'}, | |
29 {at: 1, is: 'rgb(0, 128, 0)'}, | |
30 {at: 1.5, is: 'rgb(0, 65, 0)'}, | |
31 ]); | |
32 | |
33 assertInterpolation({ | |
34 property: '--color', | |
35 from: 'initial', | |
36 to: 'green', | |
37 }, [ | |
38 {at: -0.3, is: 'rgb(0, 0, 0)'}, | |
39 {at: 0, is: 'rgb(0, 0, 0)'}, | |
40 {at: 0.3, is: 'rgb(0, 38, 0)'}, | |
41 {at: 0.6, is: 'rgb(0, 77, 0)'}, | |
42 {at: 1, is: 'rgb(0, 128, 0)'}, | |
43 {at: 1.5, is: 'rgb(0, 192, 0)'}, | |
44 ]); | |
45 | |
46 assertInterpolation({ | |
47 property: '--color', | |
48 from: 'inherit', | |
49 to: 'green', | |
50 }, [ | |
51 {at: -0.3, is: 'rgb(0, 0, 255)'}, | |
52 {at: 0, is: 'rgb(0, 0, 255)'}, | |
53 {at: 0.3, is: 'rgb(0, 38, 179)'}, | |
54 {at: 0.6, is: 'rgb(0, 77, 102)'}, | |
55 {at: 1, is: 'rgb(0, 128, 0)'}, | |
56 {at: 1.5, is: 'rgb(0, 192, 0)'}, | |
57 ]); | |
58 | |
59 assertInterpolation({ | |
60 property: '--color', | |
61 from: 'unset', | |
62 to: 'green', | |
63 }, [ | |
64 {at: -0.3, is: 'rgb(0, 0, 0)'}, | |
65 {at: 0, is: 'rgb(0, 0, 0)'}, | |
66 {at: 0.3, is: 'rgb(0, 38, 0)'}, | |
67 {at: 0.6, is: 'rgb(0, 77, 0)'}, | |
68 {at: 1, is: 'rgb(0, 128, 0)'}, | |
69 {at: 1.5, is: 'rgb(0, 192, 0)'}, | |
70 ]); | |
71 | |
72 assertInterpolation({ | |
73 property: '--color', | |
74 from: 'black', | |
75 to: 'orange', | |
76 }, [ | |
77 {at: -0.3, is: 'rgb(0, 0, 0)'}, | |
78 {at: 0, is: 'rgb(0, 0, 0)'}, | |
79 {at: 0.3, is: 'rgb(77, 50, 0)'}, | |
80 {at: 0.6, is: 'rgb(153, 99, 0)'}, | |
81 {at: 1, is: 'rgb(255, 165, 0)'}, | |
82 {at: 1.5, is: 'rgb(255, 248, 0)'}, | |
83 ]); | |
84 | |
85 assertInterpolation({ | |
86 property: '--color', | |
87 from: '-webkit-activelink', | |
88 to: 'green', | |
89 }, [ | |
90 {at: -0.3, is: 'rgb(255, 0, 0)'}, | |
91 {at: 0, is: 'rgb(255, 0, 0)'}, | |
92 {at: 0.3, is: 'rgb(179, 38, 0)'}, | |
93 {at: 0.6, is: 'rgb(102, 77, 0)'}, | |
94 {at: 1, is: 'rgb(0, 128, 0)'}, | |
95 {at: 1.5, is: 'rgb(0, 192, 0)'}, | |
96 ]); | |
97 | |
98 assertInterpolation({ | |
99 property: '--color', | |
100 from: '-webkit-link', | |
101 to: 'green', | |
102 }, [ | |
103 {at: -0.3, is: 'rgb(0, 0, 255)'}, | |
104 {at: 0, is: 'rgb(0, 0, 255)'}, | |
105 {at: 0.3, is: 'rgb(0, 38, 179)'}, | |
106 {at: 0.6, is: 'rgb(0, 77, 102)'}, | |
107 {at: 1, is: 'rgb(0, 128, 0)'}, | |
108 {at: 1.5, is: 'rgb(0, 192, 0)'}, | |
109 ]); | |
sashab
2017/01/25 02:55:00
Add test for currentColor as well :^)
alancutter (OOO until 2018)
2017/01/25 03:55:13
Added failing test. Turns out supporting currentco
| |
110 </script> | |
111 </body> | |
OLD | NEW |