Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / test / test_animations_variable_changes.html
blobac254e11360666e0c5a245e468ac5e5cba6aa2a1
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Tests that animations respond to changes to variables</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="../testcommon.js"></script>
7 <style>
8 :root {
9 --width: 100px;
11 .wider {
12 --width: 200px;
14 @keyframes widen {
15 to { margin-left: var(--width) }
17 </style>
18 <body>
19 <div id="log"></div>
20 <script>
22 test(() => {
23 const div = document.createElement('div');
24 document.body.append(div);
26 div.style.animation = 'widen step-start 100s';
27 assert_equals(getComputedStyle(div).marginLeft, '100px',
28 'Animation value before updating CSS variable');
30 div.classList.add('wider');
32 assert_equals(getComputedStyle(div).marginLeft, '200px',
33 'Animation value after updating CSS variable');
35 div.remove();
36 }, 'Animation reflects changes to custom properties');
38 test(() => {
39 const parent = document.createElement('div');
40 const child = document.createElement('div');
41 parent.append(child);
42 document.body.append(parent);
44 child.style.animation = 'widen step-start 100s';
45 assert_equals(getComputedStyle(child).marginLeft, '100px',
46 'Animation value before updating CSS variable');
48 parent.classList.add('wider');
50 assert_equals(getComputedStyle(child).marginLeft, '200px',
51 'Animation value after updating CSS variable');
53 parent.remove();
54 child.remove();
55 }, 'Animation reflect changes to custom properties on parent');
57 </script>
58 </body>