font-face-001.html (1036B)
1 <!doctype html> 2 <title>CSS Test: @font-face applies in the shadow tree.</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <link rel="author" title="Alan Stearns" href="mailto:stearns@adobe.com"> 6 <link rel="help" href="https://drafts.csswg.org/css-scoping/#shadow-names"> 7 8 <style> 9 #in-document { 10 font-family: ff-16-wide; 11 } 12 </style> 13 <div id="host"><span id="in-document">1234567890</span></div> 14 <script> 15 promise_test(async () => { 16 host.attachShadow({ mode: "open" }).innerHTML = ` 17 <style> 18 @font-face { 19 font-family: ff-16-wide; 20 src: url(/fonts/Ahem.ttf); 21 } 22 #in-shadow { 23 font-family: ff-16-wide; 24 } 25 </style> 26 <slot></slot> 27 <span id="in-shadow">0123456789</span> 28 `; 29 30 await document.fonts.ready; 31 32 assert_not_equals(document.getElementById('in-document').offsetWidth, 160); 33 assert_equals(host.shadowRoot.getElementById('in-shadow').offsetWidth, 160); 34 }, "@font-face applies in the shadow tree") 35 </script>