feat: public API, SEO and existing surfaces
This commit is contained in:
1 parent
45fbbc33b1
commit
c390fcfe8d
103 files changed
+4476
-231
No files matched your search
@@ -106,15 +106,15 @@ func TestSiteLanguagesReading(t *testing.T) {
|
||||
t.Errorf("entry = %+v", entry)
|
||||
}
|
||||
row := localization.Row{Tag: entry.Lang, SocialLocale: entry.SocialLocale}
|
||||
if !sameText(localization.EffectiveSocialLocale(row), c.effective) {
|
||||
t.Errorf("effective = %v", localization.EffectiveSocialLocale(row))
|
||||
if !sameText(localization.EffectiveSocialLocale(row, nil), c.effective) {
|
||||
t.Errorf("effective = %v", localization.EffectiveSocialLocale(row, nil))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Only the explicit value and the tag's own region resolve the social locale", func(t *testing.T) {
|
||||
t.Run("A bare tag borrows the region of Site.Locale", func(t *testing.T) {
|
||||
e := newLocalizationEnv(t)
|
||||
e.sites.seed(5, "Atelier", "atelier", false)
|
||||
gb := "en-GB"
|
||||
@@ -125,7 +125,27 @@ func TestSiteLanguagesReading(t *testing.T) {
|
||||
|
||||
view := decodeLanguagesView(t, e.owner(t, http.MethodGet, "/v1/site/atelier/languages", ""))
|
||||
|
||||
if view.Languages[0].State != "not_set" {
|
||||
if view.Languages[0].State != "derived" {
|
||||
t.Errorf("state = %q", view.Languages[0].State)
|
||||
}
|
||||
row := localization.Row{Tag: "en"}
|
||||
if !sameText(localization.EffectiveSocialLocale(row, &gb), localeOf("en_GB")) {
|
||||
t.Errorf("effective = %v", localization.EffectiveSocialLocale(row, &gb))
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("No region anywhere stays not set", func(t *testing.T) {
|
||||
e := newLocalizationEnv(t)
|
||||
e.sites.seed(5, "Atelier", "atelier", false)
|
||||
bare := "en"
|
||||
stored := e.sites.sites[5]
|
||||
stored.Locale = &bare
|
||||
e.sites.sites[5] = stored
|
||||
e.seedRows(5, localization.Row{Tag: "en", IsDefault: true, Enabled: true, Confirmed: true})
|
||||
|
||||
view := decodeLanguagesView(t, e.owner(t, http.MethodGet, "/v1/site/atelier/languages", ""))
|
||||
|
||||
if view.Languages[0].State != "not_set" || localization.EffectiveSocialLocale(localization.Row{Tag: "en"}, &bare) != nil {
|
||||
t.Errorf("state = %q", view.Languages[0].State)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user