From 65fd882fa8e18276e4530ed23aa7e0e571eab1c0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 Jul 2025 12:09:21 +0200 Subject: [PATCH] Bug 38201: install i18n on mount for component testing (cherry picked from commit 5a78bc6fbfcb25d5b62e029f2cb6feacf17e8396) Signed-off-by: Michaela Sieber Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- .../prog/js/vue/components/ShowElement.vue | 2 -- t/cypress/support/component.ts | 11 ++++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ShowElement.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ShowElement.vue index 94f898e621..4a334b7149 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ShowElement.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ShowElement.vue @@ -149,7 +149,6 @@ import LinkWrapper from "./LinkWrapper.vue"; import AdditionalFieldsDisplay from "./AdditionalFieldsDisplay.vue"; import { useBaseElement } from "../composables/base-element.js"; import { computed, defineAsyncComponent } from "vue"; -import { $__ } from "@koha-vue/i18n"; export default { components: { LinkWrapper, AdditionalFieldsDisplay }, @@ -197,7 +196,6 @@ export default { attribute, formatValue, radioOptionText, - $__, }; }, props: { diff --git a/t/cypress/support/component.ts b/t/cypress/support/component.ts index 10b46ffdf7..1a01521706 100644 --- a/t/cypress/support/component.ts +++ b/t/cypress/support/component.ts @@ -20,6 +20,7 @@ // require('./commands') import { mount } from "cypress/vue"; +import i18n from "@koha-vue/i18n"; // Augment the Cypress namespace to include type definitions for // your custom command. @@ -33,7 +34,15 @@ import { mount } from "cypress/vue"; // } // }; -Cypress.Commands.add("mount", mount); +Cypress.Commands.add("mount", (component, options = {}) => { + return mount(component, { + global: { + plugins: [i18n, ...(options.global?.plugins || [])], + ...options.global, + }, + ...options, + }); +}); // Example use: // cy.mount(MyComponent)