Skip to content

Commit

Permalink
fix: change language case (#922)
Browse files Browse the repository at this point in the history
Co-authored-by: aoltean-plenty <alexandru.oltean@plentysystems.com>
Co-authored-by: Kevin Stederoth <43753494+ksted@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 30, 2024
1 parent c9f5995 commit 991c146
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
16 changes: 16 additions & 0 deletions apps/web/__tests__/support/pageObjects/EditorObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export class EditorObject extends PageObject {
return cy.getByTestId('delete-block-button')
}

get languageSwitcher() {
return cy.getByTestId('editor-language-select');
}

togglePreviewMode() {
this.editPreviewButton.should('be.enabled').click();
this.editPreviewButton.should('contain.text', 'Preview');
Expand Down Expand Up @@ -151,5 +155,17 @@ export class EditorObject extends PageObject {
this.blockWrapper.should('have.length', initialLength - 1);
});
}

switchLanguage() {
cy.intercept('/plentysystems/getCart').as('getCart');
cy.intercept('/plentysystems/getCategoryTree').as('getCategoryTree');
cy.intercept('/plentysystems/getFacet').as('getFacet');

this.editPreviewButton.click();
this.languageSwitcher.should('exist');
this.languageSwitcher.select('de');
cy.wait(['@getCart', '@getCategoryTree', '@getFacet']);
this.headline.first().should('have.text', 'Sound auf höchstem Niveau');
}
}

5 changes: 5 additions & 0 deletions apps/web/__tests__/test/editor/editMode.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ describe('EditMode', () => {
editor.replaceEditorContent(JSON.stringify(newContent, null, 2));
editor.checkEditorChanges();
});

it('should switch language and check editor content', () => {
editor.switchLanguage();
});

});
1 change: 1 addition & 0 deletions apps/web/components/ui/LanguageEditor/LanguageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"
:disabled="isEditing || disableActions"
:class="{ 'cursor-not-allowed': isEditing || disableActions }"
data-testid="editor-language-select"
>
<option v-for="locale in localeCodes" :key="locale" :value="locale" class="font-medium text-sm md:text-base">
{{ $t(`lang.${locale}`) }}
Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/ui/Toolbar/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<UiBrandLogo />

<div class="absolute left-1/2 transform -translate-x-1/2">
<UiLanguageEditor v-if="experimentalAddBlock" />
<UiLanguageEditor />
</div>
<div class="ml-auto flex space-x-2">
<button
Expand Down Expand Up @@ -61,7 +61,6 @@ const { loading } = useHomepage();
const { updatePageTemplate } = useUpdatePageTemplate();
const homepageCategoryId = runtimeConfig.public.homepageCategoryId;
const experimentalAddBlock = runtimeConfig.public.experimentalAddBlock;
const isLocalTemplate = () => typeof homepageCategoryId === 'number';
Expand Down
12 changes: 5 additions & 7 deletions apps/web/composables/useHomepage/homepageTemplateDataDe.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
{
"name": "UiMediaCard",
"options": {
"options": {
"text": "<div class='flex flex-col mt-5 sm:mt-20 mt-0 sm:p-0 p-5 text-center sm:text-left'><span class='text-xl font-bold mb-2'>Die Zukunft des Klangs</span><h2 class='text-2xl font-semibold mb-4'>Das neue Hörerlebnis</h2><p class='typography-text-sm md:typography-text-lg mb-6 padding-right-desktop'>Unsere Kopfhörer-Kollektion setzt neue Maßstäbe in Sachen Audio-Präzision. Mit tiefem Bass, klaren Höhen und einem eindrucksvollen Klangbild bieten diese Kopfhörer ein einzigartiges Hörerlebnis für jedes Musikgenre. Mit Ihrer Kombination aus modernem Design, höchstem Komfort und neuester Technologie sind sie die perfekte Wahl für alle, die keine Kompromisse bei der Klangqualität eingehen möchten.</p><ul class='list-disc list-inside typography-text-sm md:typography-text-lg '><li>Premium-Sound in Studioqualität</li><li>Elegant und formschön</li><li>Lange Akkulaufzeit</li><li>Kabellose Verbindung via Bluetooth</li></ul></div>",
"image": "https://cdn02.plentymarkets.com/mevofvd5omld/frontend/headphones-mediacard.avif",
"alt": "Headphones",
Expand All @@ -56,7 +56,7 @@
},
{
"name": "NewsletterSubscribe",
"options": {
"options": {
"email": "E-Mail",
"firstName": "Vorname",
"heading": "Abonnieren Sie unseren Newsletter",
Expand All @@ -68,9 +68,7 @@
}
}
],
"meta": {
"isDefault": null
}
"meta": {
"isDefault": null
}
}


0 comments on commit 991c146

Please sign in to comment.