page-orientation.tentative.html (2576B)
1 <!DOCTYPE html> 2 <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> 3 <link rel="help" href="https://drafts.csswg.org/css-page-3/#page-orientation-prop"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <style> 7 @page { 8 page-orientation: rotate-right; 9 } 10 @page :left { 11 page-orientation: rotate-left; 12 } 13 @page :right { 14 page-orientation: rotate-right; 15 } 16 @page :first { 17 page-orientation: rotate-left; 18 } 19 @page named1 { 20 page-orientation: upright; 21 } 22 @page named2 { 23 page-orientation: hotpink; 24 } 25 @page named3 { 26 page-orientation: rotate-right; 27 } 28 @page named4 { 29 page-orientation: rotate-right; 30 page-orientation: rotate-left; 31 } 32 @page named5 { 33 page-orientation: hotpink; 34 page-orientation: rotate-right; 35 } 36 @page named6 { 37 page-orientation: rotate-right; 38 page-orientation: inherit; 39 page-orientation: initial; 40 page-orientation: none; 41 page-orientation: hotpink; 42 } 43 h5 { 44 page-orientation: rotate-right; 45 display: block; 46 } 47 </style> 48 <script> 49 let pageRuleExpectations = { 50 "" : "page-orientation: rotate-right;", 51 ":left" : "page-orientation: rotate-left;", 52 ":right" : "page-orientation: rotate-right;", 53 ":first" : "page-orientation: rotate-left;", 54 "named1" : "page-orientation: upright;", 55 "named2" : "", 56 "named3" : "page-orientation: rotate-right;", 57 "named4" : "page-orientation: rotate-left;", 58 "named5" : "page-orientation: rotate-right;", 59 "named6" : "page-orientation: rotate-right;", 60 }; 61 let styleRuleExpectations = { 62 "h5" : "display: block;" 63 }; 64 let styleSheets = document.styleSheets; 65 for (let i = 0; i < styleSheets.length; i++) { 66 let rules = styleSheets[i].cssRules; 67 for (let rule of rules) { 68 if (rule.type == CSSRule.PAGE_RULE) { 69 let expected = pageRuleExpectations[rule.selectorText]; 70 test(function() { 71 assert_equals(rule.style.cssText, expected, "unexpected @page contents"); 72 }, "contents for selector ['" + rule.selectorText + "']"); 73 } else if (rule.type == CSSRule.STYLE_RULE) { 74 let expected = styleRuleExpectations[rule.selectorText]; 75 test(function() { 76 assert_equals(rule.style.cssText, expected, "unexpected style rule contents"); 77 }, "contents for selector ['" + rule.selectorText + "']"); 78 } 79 } 80 } 81 </script>