summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-page/page-orientation.tentative.html
blob: 6725aa88e5e21d442dcc04271aa6e1b136002436 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-orientation-prop">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  @page {
      page-orientation: rotate-right;
  }
  @page :left {
      page-orientation: rotate-left;
  }
  @page :right {
      page-orientation: rotate-right;
  }
  @page :first {
      page-orientation: rotate-left;
  }
  @page named1 {
      page-orientation: upright;
  }
  @page named2 {
      page-orientation: hotpink;
  }
  @page named3 {
      page-orientation: rotate-right;
  }
  @page named4 {
      page-orientation: rotate-right;
      page-orientation: rotate-left;
  }
  @page named5 {
      page-orientation: hotpink;
      page-orientation: rotate-right;
  }
  @page named6 {
      page-orientation: rotate-right;
      page-orientation: inherit;
      page-orientation: initial;
      page-orientation: none;
      page-orientation: hotpink;
  }
  h5 {
      page-orientation: rotate-right;
      display: block;
  }
</style>
<script>
  let pageRuleExpectations = {
      "" : "page-orientation: rotate-right;",
      ":left" : "page-orientation: rotate-left;",
      ":right" : "page-orientation: rotate-right;",
      ":first" : "page-orientation: rotate-left;",
      "named1" : "page-orientation: upright;",
      "named2" : "",
      "named3" : "page-orientation: rotate-right;",
      "named4" : "page-orientation: rotate-left;",
      "named5" : "page-orientation: rotate-right;",
      "named6" : "page-orientation: rotate-right;",
  };
  let styleRuleExpectations = {
      "h5" : "display: block;"
  };
  let styleSheets = document.styleSheets;
  for (let i = 0; i < styleSheets.length; i++) {
      let rules = styleSheets[i].cssRules;
      for (let rule of rules) {
          if (rule.type == CSSRule.PAGE_RULE) {
              let expected = pageRuleExpectations[rule.selectorText];
              test(function() {
                  assert_equals(rule.style.cssText, expected, "unexpected @page contents");
              }, "contents for selector ['" + rule.selectorText + "']");
          } else if (rule.type == CSSRule.STYLE_RULE) {
              let expected = styleRuleExpectations[rule.selectorText];
              test(function() {
                  assert_equals(rule.style.cssText, expected, "unexpected style rule contents");
              }, "contents for selector ['" + rule.selectorText + "']");
          }
      }
  }
</script>