diff --git a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap index 65912628e525..239544b41b9c 100644 --- a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap +++ b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap @@ -99,6 +99,9 @@ Object { Object { "path": "image-size-responsive", }, + Object { + "path": "preload-fonts", + }, Object { "path": "deprecations", }, @@ -752,6 +755,11 @@ Object { "id": "image-size-responsive", "weight": 1, }, + Object { + "group": "best-practices-ux", + "id": "preload-fonts", + "weight": 1, + }, Object { "group": "best-practices-browser-compat", "id": "doctype", diff --git a/lighthouse-cli/test/fixtures/perf/cors-fonts.css b/lighthouse-cli/test/fixtures/perf/cors-fonts.css index 7929ba24a8e4..d8c2e1fab2b6 100644 --- a/lighthouse-cli/test/fixtures/perf/cors-fonts.css +++ b/lighthouse-cli/test/fixtures/perf/cors-fonts.css @@ -2,6 +2,7 @@ font-family: 'Lobster Three'; font-style: normal; font-weight: 700; + font-display: optional; src: url("http://localhost:10503/perf/lobster-two-v10-latin-700.woff2?cors=true") format('woff2'); } .corsfont { diff --git a/lighthouse-cli/test/fixtures/perf/fonts.html b/lighthouse-cli/test/fixtures/perf/fonts.html index 8c8bf52b6b7a..a6635138533f 100644 --- a/lighthouse-cli/test/fixtures/perf/fonts.html +++ b/lighthouse-cli/test/fixtures/perf/fonts.html @@ -14,8 +14,14 @@ font-style: normal; font-weight: 700; font-display: optional; - /* We don't need `local` but keep around for testing robustness of our regex */ - src: local("Lobster Two"), url("./lobster-two-v10-latin-700.woff2?delay=4000") format('woff2'); + src: url("./lobster-two-v10-latin-700.woff2?delay=4000") format('woff2'); + } + @font-face { + font-family: 'Lobster Four'; + font-style: normal; + font-weight: 700; + font-display: optional; + src: url("./lobster-two-v10-latin-700.woff2?delay=1000") format('woff2'); } .webfont { font-family: Lobster, sans-serif; @@ -26,13 +32,24 @@ .nofont { font-family: Unknown, sans-serif; } + .optionalfont { + font-family: Lobster Four, sans-serif; + } + + + + + +
Let's load some sweet webfonts...
Let's load some sweet webfonts...
Some lovely text that uses the fallback font
Some lovely text that uses a CORS font
+ +Some lovely text that uses an optional font