https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 260166c7aa434d6367910af87f67fdaf51146068 authored by Lukasz Anforowicz on 02 April 2018, 20:04:17 UTC
Tests and docs for the current CORB vs <link rel="preload"> behavior.
Tip revision: 260166c
offset-supports-calc.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Motion Path Module Level 1: calc values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/motion-1/">
<link rel="help" href="https://drafts.csswg.org/css-values-3/#calc-notation">
<meta name="assert" content="calc values are supported in offset properties.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  #target {
    font-size: 20px;
  }
</style>
</head>
<body>
<div id="target"></div>
<script>
'use strict';

test(function(){
  target.style = 'offset-position: calc(30px + 20%) calc(-200px + 8em + 100%);';
  assert_equals(getComputedStyle(target).offsetPosition, 'calc(30px + 20%) calc(-40px + 100%)');
}, 'offset-position supports calc');

test(function(){
  target.style = 'offset-path: ray(calc(1turn - 100grad) closest-side);';
  assert_equals(getComputedStyle(target).offsetPath, 'ray(270deg closest-side)');
}, 'offset-path supports calc');

test(function(){
  target.style = 'offset-distance: calc(-100px + 50%);';
  assert_equals(getComputedStyle(target).offsetDistance, 'calc(-100px + 50%)');
}, 'offset-distance supports calc');

test(function(){
  target.style = 'offset-rotate: auto calc(1turn - 100grad);';
  assert_equals(getComputedStyle(target).offsetRotate, 'auto 270deg');
}, 'offset-rotate supports calc');

test(function(){
  target.style = 'offset-anchor: calc(30px + 20%) calc(-200px + 8em + 100%);';
  assert_equals(getComputedStyle(target).offsetAnchor, 'calc(30px + 20%) calc(-40px + 100%)');
}, 'offset-anchor supports calc');

</script>
</body>
</html>
back to top