font-feature-settings-serialization-001.html (1362B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Test: font-feature-settings serialization</title> 4 <link rel="author" title="Chris Nardi" href="mailto:cnardi@chromium.org"> 5 <link rel="help" href="https://drafts.csswg.org/css-fonts-3/#feature-tag-value"> 6 <link rel="help" href="https://drafts.csswg.org/cssom/#common-serializing-idioms"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <style> 10 #test { 11 font-feature-settings: "vert" 1; 12 } 13 #test1 { 14 font-feature-settings: 'vert' 1; 15 } 16 #test2 { 17 font-feature-settings: "vert" off; 18 } 19 </style> 20 <div id="test"></div> 21 <div id="test1"></div> 22 <div id="test2"></div> 23 <script> 24 const div = document.querySelector("#test"); 25 const div1 = document.querySelector("#test1"); 26 const div2 = document.querySelector("#test2"); 27 test(function() { 28 assert_equals(getComputedStyle(div).fontFeatureSettings, '"vert"'); 29 assert_equals(getComputedStyle(div1).fontFeatureSettings, '"vert"'); 30 }, "font-feature-settings should be serialized with double quotes, and the default value of 1 should be omitted"); 31 test(function() { 32 assert_equals(getComputedStyle(div2).fontFeatureSettings, '"vert" 0'); 33 }, "font-feature-settings should serialize 0 instead of off, given it's shorter"); 34 </script>