Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / fontfaceset-ready.html
blobc55b7f3c4e7776f40143a4f02d16a9d7e9286889
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>
7 promise_test(function(t) {
8 assert_equals(document.fonts.ready, document.fonts.ready,
9 'FontFaceSet.ready should return the same promise');
11 var face = new FontFace('test', 'url(../../resources/Ahem.ttf)');
13 return document.fonts.ready
14 .then(function(fonts) {
15 assert_equals(fonts, document.fonts,
16 'FontFaceSet.ready should be resolved with the FontFaceSet');
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 FontFace 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 FontFace 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 resolved');
36 });
37 }, 'FontFaceSet.ready attribute');
39 </script>