summaryrefslogtreecommitdiffstats
path: root/layout/style/test/file_specified_value_serialization_individual_transforms.html
blob: 9dcf85f955992371ed73c01711f1552da9ceb7fe (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!doctype html>
<meta charset=utf-8>
<title>Test for Bug 1207734 (individual transforms)</title>
<!--
  FIXME: This is only here in a separate file since it needs the
  layout.css.individual-transform.enabled pref to be set when it runs and the
  pref= annotation in mochitest.ini doesn't work on Android (bug 1393326).
  Once we turn on that pref by default or fix bug 1393326 we can move this back
  into test_specified_value_serialization.html.
-->
<script>
const is = opener.is.bind(opener);
function finish() {
  const o = opener;
  self.close();
  o.SimpleTest.finish();
}

function runTest() {
  // Test for rotate property serialization.
  [
    [" 90deg ", "90deg"],
    [" 100grad ", "100grad"],
    [" 100gRaD ", "100grad"],
    [" 0.25turn  ", "0.25turn"],
    [" 0.25tUrN  ", "0.25turn"],
    [" 1.57RaD  ", "1.57rad"],
  ].forEach(function(arr) {
    document.documentElement.style.rotate = arr[0];
    is(document.documentElement.style.rotate, arr[1],
      "bug-1207734: incorrect rotate serialization");
  });
  document.documentElement.style.rotate = "";

  // Test for translate property serialization.
  [
    [" 50% 5px 6px ", "50% 5px 6px"],
    [" 50% 10px 100px ", "50% 10px 100px"],
    [" 4px 5px ", "4px 5px"],
    [" 10% 10% 99px  ", "10% 10% 99px"],
    ["   50px    ", "50px"],
  ].forEach(function(arr) {
    document.documentElement.style.translate = arr[0];
    is(document.documentElement.style.translate, arr[1],
      "bug-1207734: incorrect translate serialization");
  });
  document.documentElement.style.translate = "";

  // Test for scale property serialization.
  [
    [" 10  ", "10"],
    [" 10 20.5 ", "10 20.5"],
    [" 10 20  30 ", "10 20 30"],
  ].forEach(function(arr) {
    document.documentElement.style.scale = arr[0];
    is(document.documentElement.style.scale, arr[1],
      "bug-1207734: incorrect scale serialization");
  });

  document.documentElement.style.scale = "";
}

runTest();
finish();
</script>