From 02ddf66e85c4b079e9475e30844d0130d16cbf2b Mon Sep 17 00:00:00 2001 From: David Biddle Date: Mon, 9 Dec 2024 10:07:59 +0000 Subject: [PATCH] Add a test for GDS Transport font loading It's possible for changes to our build to cause assets not to be built properly. One of the problems this causes is a failure to load the GDS Transport font. This commit adds a test which will fail if the GDS Transport font is referenced in a font-face declaration but fails to load. --- spec/features/components/preview_components_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/features/components/preview_components_spec.rb b/spec/features/components/preview_components_spec.rb index 70a563247..29cfa7185 100644 --- a/spec/features/components/preview_components_spec.rb +++ b/spec/features/components/preview_components_spec.rb @@ -13,4 +13,11 @@ expect_component_to_have_no_axe_errors(page) end end + + it "checks GDS Transport font is available" do + visit "/preview/" + font_loaded = evaluate_script("document.fonts.check('12px GDS Transport')") + + expect(font_loaded).to be true + end end