| <!DOCTYPE html> |
| <html> |
| <head> |
| <link rel="help" href="https://drafts.csswg.org/web-animations-2#animation-trigger"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <style> |
| .scroller { |
| overflow-y: scroll; |
| border: solid 1px; |
| place-self: center; |
| height: 300px; |
| width: 200px; |
| } |
| @keyframes slide-in { |
| from { |
| transform: translateX(-50px); |
| } |
| } |
| .target { |
| height: 100px; |
| width: 100%; |
| background-color: blue; |
| animation: slide-in 3s; |
| animation-trigger: view() alternate contain 0% contain 100%; |
| } |
| .target { |
| height: 100px; |
| width: 100%; |
| background-color: blue; |
| } |
| .space { |
| height: 250px; |
| width: 50%; |
| } |
| |
| .active { |
| animation-fill-mode: both; |
| } |
| .idle { |
| animation-fill-mode: none; |
| } |
| |
| </style> |
| <div id="scroller" class="scroller"> |
| <div class="space"></div> |
| <div id="subject"></div> |
| <div class="space"></div> |
| <div id="active_target" class="active target"></div> |
| <div id="idle_target" class="idle target"></div> |
| </div> |
| <script> |
| promise_test(async () => { |
| assert_equals(idle_target.getAnimations().length, 1, |
| "idle target has an animation"); |
| }, "getAnimations includes an untriggered " + |
| "'fill-mode: none' animation."); |
| |
| promise_test(async () => { |
| assert_equals(active_target.getAnimations().length, 1, |
| "active target has an animation"); |
| }, "getAnimations does include an untriggered " + |
| "'fill-mode: both' animation."); |
| </script> |
| </body> |
| </html> |