Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 90 subtest issues.
 - This WPT test may be referenced by the following Test IDs:
            
- /css/css-values/calc-size/animation/interpolate-size-max-height-interpolation.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<meta charset="UTF-8">
<title>max-height interpolation with interpolate-size: allow-keywords</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
:root {
  interpolate-size: allow-keywords;
}
.parent {
  height: 200px;
  max-height: 300px;
}
.target {
  width: 100px;
  height: 50px;
  max-height: 100px;
}
.target::before {
  display: block;
  content: "";
  width: 100px;
  height: 50px;
}
</style>
<body>
<template id="target-template">
  <div>
    <div class="target"></div>
  </div>
</template>
</body>
<script>
test_no_interpolation({
  property: 'max-height',
  from: 'initial',
  to: '20px',
});
test_no_interpolation({
  property: 'max-height',
  from: 'unset',
  to: '20px',
});
test_no_interpolation({
  property: 'max-height',
  from: 'none',
  to: '20px',
});
test_no_interpolation({
  property: 'max-height',
  from: 'none',
  to: 'max-content',
});
test_no_interpolation({
  property: 'max-height',
  from: 'stretch',
  to: 'fit-content',
});
test_interpolation({
  property: 'max-height',
  from: '150px',
  to: 'min-content', /* (50px) */
}, [
  {at: -0.3, expect: 'calc-size(min-content, 195px + size * -0.3)'},
  {at: 0, expect: 'calc-size(min-content, 150px + size * 0)'},
  {at: 0.3, expect: 'calc-size(min-content, 105px + size * 0.3)'},
  {at: 0.6, expect: 'calc-size(min-content, 60px + size * 0.6)'},
  {at: 1, expect: 'calc-size(min-content, 0px + size * 1)'},
  {at: 1.5, expect: 'calc-size(min-content, -75px + size * 1.5)'}
]);
test_interpolation({
  property: 'max-height',
  from: 'min-content', /* (50px) */
  to: neutralKeyframe, /* 100px */
}, [
  {at: -0.3, expect: 'calc-size(min-content, -30px + size * 1.3)'},
  {at: 0, expect: 'calc-size(min-content, 0px + size * 1)'},
  {at: 0.3, expect: 'calc-size(min-content, 30px + size * 0.7)'},
  {at: 0.6, expect: 'calc-size(min-content, 60px + size * 0.4)'},
  {at: 1, expect: 'calc-size(min-content, 100px + size * 0)'},
  {at: 1.5, expect: 'calc-size(min-content, 150px + size * -0.5)'}
]);
test_interpolation({
  property: 'max-height',
  from: neutralKeyframe, /* 100px */
  to: 'max-content', /* (50px) */
}, [
  {at: -0.3, expect: 'calc-size(max-content, 130px + size * -0.3)'},
  {at: 0, expect: 'calc-size(max-content, 100px + size * 0)'},
  {at: 0.3, expect: 'calc-size(max-content, 70px + size * 0.3)'},
  {at: 0.6, expect: 'calc-size(max-content, 40px + size * 0.6)'},
  {at: 1, expect: 'calc-size(max-content, 0px + size * 1)'},
  {at: 1.5, expect: 'calc-size(max-content, -50px + size * 1.5)'}
]);
</script>