test_bug892929.html (2983B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset=utf-8> 5 <title>Bug 892929 test</title> 6 <link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com"> 7 <link rel="help" href="http://www.w3.org/TR/css-fonts-3/#om-fontfeaturevalues" /> 8 <meta name="assert" content="window.CSSFontFeatureValuesRule should appear by default" /> 9 <script type="text/javascript" src="/resources/testharness.js"></script> 10 <script type="text/javascript" src="/resources/testharnessreport.js"></script> 11 <style type="text/css"> 12 </style> 13 </head> 14 <body> 15 <div id="log"></div> 16 <pre id="display"></pre> 17 18 <script type="text/javascript"> 19 20 function testCSSFontFeatureValuesRuleOM() { 21 var s = document.documentElement.style; 22 var cs = window.getComputedStyle(document.documentElement); 23 24 var hasFFVRule = "CSSFontFeatureValuesRule" in window; 25 var hasStyleAlternates = "fontVariantAlternates" in s; 26 var hasCompStyleAlternates = "fontVariantAlternates" in cs; 27 28 test(function() { 29 assert_equals(hasFFVRule, 30 hasStyleAlternates, 31 "style.fontVariantAlternates " + 32 (hasStyleAlternates ? "available" : "not available") + 33 " but " + 34 "window.CSSFontFeatureValuesRule " + 35 (hasFFVRule ? "available" : "not available") + 36 " - "); 37 }, "style.fontVariantAlternates availability matches window.CSSFontFeatureValuesRule availability"); 38 39 test(function() { 40 assert_equals(hasFFVRule, 41 hasCompStyleAlternates, 42 "computedStyle.fontVariantAlternates " + 43 (hasCompStyleAlternates ? "available" : "not available") + 44 " but " + 45 "window.CSSFontFeatureValuesRule " + 46 (hasFFVRule ? "available" : "not available") + 47 " - "); 48 }, "computedStyle.fontVariantAlternates availability matches window.CSSFontFeatureValuesRule availability"); 49 50 // if window.CSSFontFeatureValuesRule isn't around, neither should any of the font feature props 51 fontFeatureProps = [ "fontKerning", "fontVariantAlternates", "fontVariantCaps", "fontVariantEastAsian", 52 "fontVariantLigatures", "fontVariantNumeric", "fontVariantPosition", "fontSynthesis", 53 "fontFeatureSettings", "fontLanguageOverride" ]; 54 55 if (!hasFFVRule) { 56 var i; 57 for (i = 0; i < fontFeatureProps.length; i++) { 58 var prop = fontFeatureProps[i]; 59 test(function() { 60 assert_true(!(prop in s), "window.CSSFontFeatureValuesRule not available but style." + prop + " is available - "); 61 }, "style." + prop + " availability"); 62 test(function() { 63 assert_true(!(prop in cs), "window.CSSFontFeatureValuesRule not available but computedStyle." + prop + " is available - "); 64 }, "computedStyle." + prop + " availability"); 65 } 66 } 67 68 } 69 70 testCSSFontFeatureValuesRuleOM(); 71 72 </script> 73 </body> 74 </html>