Index: LayoutTests/fast/css/fontfaceset-ready.html |
diff --git a/LayoutTests/fast/css/fontfaceset-ready.html b/LayoutTests/fast/css/fontfaceset-ready.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c55b7f3c4e7776f40143a4f02d16a9d7e9286889 |
--- /dev/null |
+++ b/LayoutTests/fast/css/fontfaceset-ready.html |
@@ -0,0 +1,39 @@ |
+<!DOCTYPE html> |
+<title>FontFaceSet.ready attribute</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+ |
+promise_test(function(t) { |
+ assert_equals(document.fonts.ready, document.fonts.ready, |
+ 'FontFaceSet.ready should return the same promise'); |
+ |
+ var face = new FontFace('test', 'url(../../resources/Ahem.ttf)'); |
+ |
+ return document.fonts.ready |
+ .then(function(fonts) { |
+ assert_equals(fonts, document.fonts, |
+ 'FontFaceSet.ready should be resolved with the FontFaceSet'); |
+ |
+ var oldReady = document.fonts.ready; |
+ document.fonts.add(face); |
+ assert_equals(document.fonts.ready, oldReady, |
+ 'FontFaceSet.ready should not be replaced when FontFace added to it is not loading'); |
+ assert_equals(document.fonts.status, 'loaded', |
+ 'FontFaceSet.status after adding unloaded FontFace'); |
+ face.load(); |
+ var newReady = document.fonts.ready; |
+ assert_not_equals(newReady, oldReady, |
+ 'FontFaceSet.ready should be replaced when a FontFace in it started loading'); |
+ assert_equals(document.fonts.status, 'loading', |
+ 'FontFaceSet.status after calling load() on a FontFace in it'); |
+ return newReady; |
+ }).then(function(fonts) { |
+ assert_equals(face.status, 'loaded', |
+ 'FontFaceSet.ready should be resolved after all fonts have been loaded'); |
+ assert_equals(document.fonts.status, 'loaded', |
+ 'FontFaceSet.status after FontFaceSet.ready is resolved'); |
+ }); |
+}, 'FontFaceSet.ready attribute'); |
+ |
+</script> |