blob: 963450cd5b23cb430b0e97bd198fb8254e91638c [file] [log] [blame]
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#angles">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-serialize">
<link rel="author" title="Apple Inc">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/serialize-testcommon.js"></script>
<div id=target></div>
<script>
function test_serialization(t,s,c,u, {prop="transform"}={}) {
t = `rotate(${t})`;
test_specified_serialization(prop, t, `rotate(${s})`);
test_computed_serialization(prop, t, c);
if(u) test_used_serialization(prop, t, u);
}
// Browsers aren't perfectly interoperable about how a 90deg rotation is serialized,
// but that's not the focus of this test,
// so just capture *whatever* the browser does and expect that.
const rotateMatrix = (()=>{
const el = document.querySelector("#target");
el.style.transform = "rotate(90deg)";
const ret = getComputedStyle(el).transform;
el.removeAttribute('style');
return ret;
})();
test_serialization(
'acos(0)',
'calc(90deg)',
rotateMatrix);
test_serialization(
'asin(1)',
'calc(90deg)',
rotateMatrix);
test_serialization(
'calc(acos(pi - pi))',
'calc(90deg)',
rotateMatrix);
test_serialization(
'calc(asin(pi - pi + 1))',
'calc(90deg)',
rotateMatrix);
test_serialization(
'calc(atan(infinity))',
'calc(90deg)',
rotateMatrix);
</script>