summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-typed-om/rotate-by-added-angle.html
blob: bb79a7df8d27c708e21a70a7589fbfa0422be3fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-typed-om-1/#stylevalue-subclasses">
<link rel="match" href="rotate-by-added-angle-ref.html">
<meta name="assert" content="CSSUnitValue of different angle units can be added correctly.">
<style>
.common {
  width: 200px;
  height: 100px;
  position: absolute;
  top: 100px;
  left: 100px;
}
.ref {
  transform: rotate(90deg);
  background-color: red;
}
.test {
  background-color: green;
  z-index: 1;
}
</style>
<p>Test passes if there is a filled green rectangle with <strong>no red</strong>.</p>
<div class="common ref"></div>
<div class="common test"></div>
<script>
const angle = new CSSMathSum(CSS.deg(45), CSS.turn(0.125)); // 90 degrees
const transform = new CSSTransformValue([new CSSRotate(angle)]);
const target = document.querySelector('.test');
target.attributeStyleMap.set('transform', transform);
</script>