Skip to content

Commit

Permalink
Merge branch '263-vocabs-without-apache' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sroertgen committed Jan 15, 2024
2 parents d6e0f2c + 45e7e7c commit 0c80242
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions cypress/e2e/conceptSchemeAndConcept.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,28 @@ describe("Concept Scheme and Concept", () => {
cy.get("h1").should("have.text", "Konzept 1")
})
})

describe("Parsing language from URL on Concept Schemes and Concepts", () => {
it("Visting a Concept Scheme directly with a language url param shows correct language", () => {
cy.visit("/w3id.org/kim/hochschulfaechersystematik/scheme.html?lang=de", {
onBeforeLoad(win) {
Object.defineProperty(win.navigator, "language", { value: "en-EN" })
},
})
cy.get(".conceptScheme > a").should(
"have.text",
"Destatis-Systematik der Fächergruppen, Studienbereiche und Studienfächer"
)
})
it("Visting a Concept directly with a language url param shows correct language", () => {
cy.visit("/w3id.org/kim/hochschulfaechersystematik/n1.html?lang=de", {
onBeforeLoad(win) {
Object.defineProperty(win.navigator, "language", { value: "en-EN" })
},
})
cy.get(".conceptScheme > a").should(
"have.text",
"Destatis-Systematik der Fächergruppen, Studienbereiche und Studienfächer"
)
})
})
2 changes: 1 addition & 1 deletion src/templates/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const App = ({ pageContext, children, location }) => {

if (languageFromUrl && !data.selectedLanguage) {
const userLang = getUserLang({
availableLanguages: data?.conceptSchemeLanguages,
availableLanguages: conceptSchemes[currentScheme.id].languages,
selectedLanguage: languageFromUrl,
})
setLanguage(userLang)
Expand Down

0 comments on commit 0c80242

Please sign in to comment.