OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>FontFaceSet.ready attribute</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 |
| 7 promise_test(function(t) { |
| 8 assert_equals(document.fonts.ready, document.fonts.ready, |
| 9 'FontFaceSet.ready should return the same promise'); |
| 10 |
| 11 var face = new FontFace('test', 'url(../../resources/Ahem.ttf)'); |
| 12 |
| 13 return document.fonts.ready |
| 14 .then(function(fonts) { |
| 15 assert_equals(fonts, document.fonts, |
| 16 'FontFaceSet.ready should be resolved with the FontFac
eSet'); |
| 17 |
| 18 var oldReady = document.fonts.ready; |
| 19 document.fonts.add(face); |
| 20 assert_equals(document.fonts.ready, oldReady, |
| 21 'FontFaceSet.ready should not be replaced when FontFac
e added to it is not loading'); |
| 22 assert_equals(document.fonts.status, 'loaded', |
| 23 'FontFaceSet.status after adding unloaded FontFace'); |
| 24 face.load(); |
| 25 var newReady = document.fonts.ready; |
| 26 assert_not_equals(newReady, oldReady, |
| 27 'FontFaceSet.ready should be replaced when a FontF
ace in it started loading'); |
| 28 assert_equals(document.fonts.status, 'loading', |
| 29 'FontFaceSet.status after calling load() on a FontFace
in it'); |
| 30 return newReady; |
| 31 }).then(function(fonts) { |
| 32 assert_equals(face.status, 'loaded', |
| 33 'FontFaceSet.ready should be resolved after all fonts
have been loaded'); |
| 34 assert_equals(document.fonts.status, 'loaded', |
| 35 'FontFaceSet.status after FontFaceSet.ready is resolve
d'); |
| 36 }); |
| 37 }, 'FontFaceSet.ready attribute'); |
| 38 |
| 39 </script> |
OLD | NEW |