display-interpolation.html (1918B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://github.com/w3c/csswg-drafts/issues/6429"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/css/support/interpolation-testcommon.js"></script> 7 8 <body> 9 <script> 10 const alwaysBlock = [ 11 {at: -1, expect: 'block'}, 12 {at: 0, expect: 'block'}, 13 {at: 0.1, expect: 'block'}, 14 {at: 0.9, expect: 'block'}, 15 {at: 1, expect: 'block'}, 16 {at: 1.5, expect: 'block'}, 17 ]; 18 const alwaysNone = [ 19 {at: -1, expect: 'none'}, 20 {at: 0, expect: 'none'}, 21 {at: 0.1, expect: 'none'}, 22 {at: 0.9, expect: 'none'}, 23 {at: 1, expect: 'none'}, 24 {at: 1.5, expect: 'none'}, 25 ]; 26 27 test_interpolation({ 28 property: 'display', 29 behavior: 'allow-discrete', 30 from: 'block', 31 to: 'none', 32 }, [ 33 {at: -1, expect: 'block'}, 34 {at: 0, expect: 'block'}, 35 {at: 0.1, expect: 'block'}, 36 {at: 0.9, expect: 'block'}, 37 {at: 1, expect: 'none'}, 38 {at: 1.5, expect: 'none'}, 39 ]); 40 41 // This transitions test expect 'block' at every point because transitioning 42 // from display:none does not provide an initial style. This is expected and 43 // can be worked around by using @initial. 44 test_interpolation({ 45 property: 'display', 46 behavior: 'allow-discrete', 47 from: 'none', 48 to: 'block', 49 'CSS Transitions with transition: all': alwaysBlock, 50 'CSS Transitions': alwaysBlock 51 }, [ 52 {at: -1, expect: 'none'}, 53 {at: 0, expect: 'none'}, 54 {at: 0.1, expect: 'block'}, 55 {at: 0.9, expect: 'block'}, 56 {at: 1, expect: 'block'}, 57 {at: 1.5, expect: 'block'}, 58 ]); 59 60 test_no_interpolation({ 61 property: 'display', 62 from: 'inline', 63 to: 'block' 64 }); 65 66 test_interpolation({ 67 property: 'display', 68 behavior: 'allow-discrete', 69 from: 'block', 70 to: 'block' 71 }, alwaysBlock); 72 73 test_interpolation({ 74 property: 'display', 75 behavior: 'allow-discrete', 76 from: 'none', 77 to: 'none' 78 }, alwaysNone); 79 </script>