From 75d806a6f4c0091aa3497de36fda74442caa5676 Mon Sep 17 00:00:00 2001 From: Joeli Takala Date: Tue, 8 Oct 2024 11:17:58 +0300 Subject: [PATCH] Removed the language list from SKOSMOS object and hardcoded the relevant cypress test to avoid a false positive test result --- src/view/scripts.inc.twig | 1 - tests/cypress/template/vocab-search-bar.cy.js | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/view/scripts.inc.twig b/src/view/scripts.inc.twig index 670c6a716..5a4e82424 100644 --- a/src/view/scripts.inc.twig +++ b/src/view/scripts.inc.twig @@ -35,7 +35,6 @@ window.SKOSMOS = { "uri": "{{ concept.uri }}", {% endif %} {%- if request.vocab ~%} - "languages": [{% for lang in request.vocab.config.languages %}"{{ lang }}"{% if not loop.last %}, {% endif %}{% endfor %}], "languageOrder": [{% for lang in request.vocab.config.languageOrder(request.contentLang) %}"{{ lang }}"{% if not loop.last %}, {% endif %}{% endfor %}], "showNotation": {{ request.vocab.config.showNotation ? "true" : "false" }}, "sortByNotation": {% if request.vocab.config.sortByNotation %}"{{ request.vocab.config.sortByNotation }}"{% else %}null{% endif ~%}, diff --git a/tests/cypress/template/vocab-search-bar.cy.js b/tests/cypress/template/vocab-search-bar.cy.js index 736022d1b..f7a5c8d8d 100644 --- a/tests/cypress/template/vocab-search-bar.cy.js +++ b/tests/cypress/template/vocab-search-bar.cy.js @@ -61,8 +61,7 @@ describe('Vocab search bar', () => { cy.get('#language-list .dropdown-item').then($elements => { const actualLanguages = $elements.map((index, el) => Cypress.$(el).attr('value')).get(); - // The expected languages should be those found in vocabulary configuration with an additional 'all' language - const expectedLanguages = [...win.SKOSMOS.languages, 'all']; + const expectedLanguages = ['fi', 'sv', 'se', 'en', 'all']; // The two language lists should be of equal length and all of the expected languages can be found expect(expectedLanguages).to.have.lengthOf(actualLanguages.length);