Project updates from Template (#1)
This PR contains the latest updates from the generic Website template, which have been added while working on #loud-amsterdam. Reviewed-on: #1 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -32,6 +32,39 @@ struct IndexPageTests {
|
||||
#expect(html.contains("/js/index.js"))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `renders no font preloads until fonts are declared`() {
|
||||
// The template ships no fonts, so a preload link here would point at a file the service does not serve.
|
||||
#expect(IndexPage.preloadedFonts.isEmpty)
|
||||
#expect(!IndexPage(locale: .init(identifier: "en")).render().contains(#"rel="preload""#))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `renders no canonical URL until an origin is given`() {
|
||||
#expect(!IndexPage(locale: .init(identifier: "en")).render().contains(#"rel="canonical""#))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `renders the canonical URL as the bare origin for the default language`() {
|
||||
// The root is the one path with no trailing slash for `TrailingSlashRedirectMiddleware` to strip.
|
||||
let html = IndexPage(
|
||||
locale: .init(identifier: "en"),
|
||||
siteOrigin: "https://example.com"
|
||||
).render()
|
||||
|
||||
#expect(html.contains(#"<link rel="canonical" href="https://example.com">"#))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `renders no language alternates for a single-language catalog`() {
|
||||
// The template serves one language, so a set naming one edition would tell a crawler nothing.
|
||||
#expect(Language.all.count == 1)
|
||||
#expect(!IndexPage(
|
||||
locale: .init(identifier: "en"),
|
||||
siteOrigin: "https://example.com"
|
||||
).render().contains("hreflang"))
|
||||
}
|
||||
|
||||
@Test
|
||||
func `renders versioned asset URLs when given a version`() {
|
||||
let html = IndexPage(
|
||||
|
||||
Reference in New Issue
Block a user