font-shorthand-subproperties-reset.html (2254B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Fonts Module Level 4: Resetting font shorthand subproperties</title> 6 <link rel="author" title="Munira Tursunova" href="moonira@google.com"> 7 <link rel="help" href="https://drafts.csswg.org/css-fonts/#font-prop"> 8 <meta name="assert" content="All subproperties of the font property are first reset to their initial values."> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <div id="test"></div> 12 <script> 13 14 function set_font_subproperty(property, value) { 15 const element = document.getElementById('test') 16 element.style = '' 17 element.style[property] = value 18 } 19 20 function test_font_shorthand_resetting_subproperty(property, newValue) { 21 if (!CSS.supports(property, newValue)) 22 return 23 test(() => { 24 let testElem = document.getElementById('test'); 25 let computed = window.getComputedStyle(testElem); 26 let initialValue = computed[property]; 27 set_font_subproperty(property, newValue); 28 document.getElementById('test').style.font = '16px serif'; 29 assert_equals(computed[property], initialValue); 30 assert_not_equals(computed.font, ""); 31 }, 'Property ' + property + ' should be reset to its initial value.') 32 } 33 34 test_font_shorthand_resetting_subproperty('font-size-adjust', '0') 35 test_font_shorthand_resetting_subproperty('font-kerning', 'normal') 36 test_font_shorthand_resetting_subproperty('font-variant-caps', 'all-small-caps') 37 test_font_shorthand_resetting_subproperty('font-variant-ligatures', 'none') 38 test_font_shorthand_resetting_subproperty('font-variant-position', 'sub') 39 test_font_shorthand_resetting_subproperty('font-variant-numeric', 'ordinal') 40 test_font_shorthand_resetting_subproperty('font-variant-alternates', 'historical-forms') 41 test_font_shorthand_resetting_subproperty('font-variant-east-asian', 'full-width') 42 test_font_shorthand_resetting_subproperty('font-variant-emoji', 'text') 43 test_font_shorthand_resetting_subproperty('font-feature-settings', '"sinf"') 44 test_font_shorthand_resetting_subproperty('font-language-override', '"SRB"') 45 test_font_shorthand_resetting_subproperty('font-optical-sizing', 'none') 46 test_font_shorthand_resetting_subproperty('font-variation-settings', '"aaaa" 1') 47 48 </script>