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 face.load(); | |
21 var newReady = document.fonts.ready; | |
dominicc (has gone to gerrit)
2015/09/02 00:14:06
Exactly when does document.fonts.ready get reset?
Kunihiko Sakamoto
2015/09/02 05:05:42
That is when face.load() is called. Added another
| |
22 assert_not_equals(newReady, oldReady, | |
dominicc (has gone to gerrit)
2015/09/02 00:14:06
Because resetting [[ReadyPromise]] happens at the
Kunihiko Sakamoto
2015/09/02 05:05:41
Done.
| |
23 'FontFaceSet.ready should be replaced when a FontF ace in it started loading'); | |
24 return newReady; | |
25 }).then(function(fonts) { | |
26 assert_equals(face.status, 'loaded', | |
27 'FontFaceSet.ready should be resolved after all fonts have been loaded'); | |
28 }); | |
29 }, 'FontFaceSet.ready attribute'); | |
30 | |
31 </script> | |
OLD | NEW |