animation-nested-transition.html (1255B)
1 <!doctype html> 2 <title>Container Queries - Animated container with inner transition</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#animated-containers"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="support/cq-testcommon.js"></script> 7 <style> 8 @keyframes outer { 9 from { width: 100px; } 10 to { width: 300px; } 11 } 12 #container { 13 container-type: inline-size; 14 animation: outer 1s linear paused; 15 } 16 #target { 17 background-color: rgb(100, 100, 100); 18 } 19 20 @container (min-width: 200px) { 21 #target { 22 transition: background-color 100s steps(2, start); 23 background-color: rgb(200, 200, 200); 24 } 25 } 26 </style> 27 <div id=container> 28 <div id=target> 29 Test 30 </div> 31 </div> 32 <script> 33 setup(() => assert_implements_size_container_queries()); 34 35 test(() => { 36 assert_equals(getComputedStyle(target).backgroundColor, 'rgb(100, 100, 100)'); 37 38 assert_equals(container.getAnimations().length, 1); 39 let animation = container.getAnimations()[0]; 40 animation.currentTime = 600; 41 42 assert_equals(getComputedStyle(target).backgroundColor, 'rgb(150, 150, 150)'); 43 }, 'Animated container size triggers transition'); 44 </script>