font-variation-settings-serialization-002.html (1348B)
1 <!DOCTYPE html> 2 <html lang="en"> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 4 <title>CSS Test: font-variation-settings serialization</title> 5 <link rel="author" title="Sejal Anand" href="mailto:sejalanand@microsoft.com"> 6 <link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-rend-desc"> 7 <meta name="description" content="Font variation settings should be serialized in sorted order."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <style> 11 @font-face { 12 font-family: "Roboto"; 13 src: url('support/fonts/RobotoExtremo-VF.subset.ttf') format('truetype'); 14 } 15 .test1 { 16 font-family: "Roboto"; 17 font-variation-settings: 'wdth' 125, 'wght' 400, 'opsz' 144; 18 } 19 </style> 20 <body> 21 <p>Test passes if font variation settings are correctly sorted in serialization.</p> 22 <div class="test1">Sample text</div> 23 <script> 24 test(function() { 25 const computedSettings = getComputedStyle(document.querySelector('.test1')).fontVariationSettings; 26 const expectedSettings = '"opsz" 144, "wdth" 125, "wght" 400'; 27 assert_equals(computedSettings, expectedSettings, 28 "Font variation settings should be sorted when serialized."); 29 }, "Check if font variation settings serialization is sorted."); 30 </script> 31 </body> 32 </html>