summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-font-loading/fontface-load-in-modal-dialog.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-font-loading/fontface-load-in-modal-dialog.html')
-rw-r--r--testing/web-platform/tests/css/css-font-loading/fontface-load-in-modal-dialog.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-font-loading/fontface-load-in-modal-dialog.html b/testing/web-platform/tests/css/css-font-loading/fontface-load-in-modal-dialog.html
new file mode 100644
index 0000000000..8838e05eaf
--- /dev/null
+++ b/testing/web-platform/tests/css/css-font-loading/fontface-load-in-modal-dialog.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<link rel="author" title="Xiaocheng Hu" href="xiaochengh@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-font-loading/#font-face-load">
+<link rel="help" href="https://crbug.com/1092411">
+<meta name="assert" content="Ensure that content of a modal dialog is re-rendered with loaded web font." />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+#target {
+ font: 25px/1 custom-font, monospace;
+}
+</style>
+<dialog><span id=target>0123456789</span></dialog>
+<script>
+document.querySelector('dialog').showModal();
+
+function raf() {
+ return new Promise(resolve => requestAnimationFrame(resolve));
+}
+
+promise_test(async () => {
+ await raf();
+
+ const face = new FontFace('custom-font', 'url(/fonts/Ahem.ttf)');
+ document.fonts.add(face);
+ await face.load();
+
+ assert_equals(target.offsetWidth, 250);
+}, 'Modal dialog content should be re-rendered with loaded web font');
+</script>