gecko-dev/testing/web-platform/tests/css/motion/offset-supports-calc.html
Eric Willigers f4bf6f2143 Bug 1508211 [wpt PR 14121] - CSS: Serialize % before px in calc, a=testonly
Automatic update from web-platform-testsCSS: Serialize % before px in calc

https://drafts.csswg.org/css-values/#math-function-serialize-a-summation
Percentage should be serialized before dimensions with units

Also fix typo in WPTs svg/geometry/parsing/*-computed.svg
calc(50% + 60x) becomes calc(50% + 60px)

BUG=904805

Change-Id: I2ecb732564c405f9315a1ef06e5bd0777c407f19
Reviewed-on: https://chromium-review.googlesource.com/c/1341289
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609262}

--

wpt-commits: 6f90ad64b9f531ae835623e445a6010031a52aa7
wpt-pr: 14121
2018-11-23 18:36:44 +00:00

50 lines
1.7 KiB
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(20% + 30px) calc(100% + -40px)');
}, '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(50% + -100px)');
}, '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(20% + 30px) calc(100% + -40px)');
}, 'offset-anchor supports calc');
</script>
</body>
</html>