19 Commits

Author SHA1 Message Date
johannes.vos 27f696247d test: move language switch test, fix header comments and code indentation 2026-06-04 13:43:07 +02:00
johannes.vos 3a07b0482f chore: add @vue/test-utils to devDependencies 2026-06-04 13:43:07 +02:00
johannes.vos 88634e10cd validate dropdown closes on click outside the component 2026-06-04 13:43:07 +02:00
johannes.vos 98cc6b7556 assert language selection updates localStorage and HTML attributes 2026-06-04 13:43:07 +02:00
johannes.vos 0bb0f23347 verify initial closed state and toggle opening of dropdown 2026-06-04 13:43:07 +02:00
johannes.vos 02af96a07d initialize language switch test suite with beforeEach setup 2026-06-04 13:43:07 +02:00
johannes.vos a6194bb874 mock i18n and icon dependencies for language switch 2026-06-04 13:43:07 +02:00
johannes.vos d6700d6965 add imports 2026-06-04 13:43:07 +02:00
johannes.vos 54ffaf73e3 add license 2026-06-04 13:43:07 +02:00
johannes.vos ebe21f7f4d add LanguageSwitchButton.test.js file - empty 2026-06-04 13:43:07 +02:00
jakob.scheid 37515268d7 Merge pull request 'Fix navbar alignment on mobile devices' (#110) from feature/fix-navbar-alignment-on-mobile-devices into main
Deploy on dev / Deploy on dev (push) Successful in 32s
Reviewed-on: #110
Reviewed-by: Jakob Gregory <7+jakob.gregory@noreply.localhost>
Reviewed-by: Jakob Scheid
2026-06-04 13:40:29 +02:00
jakob.scheid c919263c36 feat(navbar-padding): use the responsivity of the main content padding CSS variables 2026-06-04 13:39:58 +02:00
jakob.scheid 592eb7222f move main content padding CSS variables to the app wrapper 2026-06-04 13:39:58 +02:00
johannes.vos 98579b726b style(nav): reduce navbar horizontal padding on small screens for better alignment 2026-06-04 13:39:58 +02:00
jakob.scheid 4e6c94afc8 Merge pull request 'Fix spacing between Seekra logo and slogan' (#109) from feature/vertical-spacing-slogan-logo into main
Deploy on dev / Deploy on dev (push) Successful in 32s
Reviewed-on: #109
Reviewed-by: Jakob Gregory
2026-06-04 13:22:17 +02:00
johannes.vos f2f7e9e23c remove unnecesary empty code lines 2026-06-04 13:16:31 +02:00
johannes.vos 08949d5bb4 remove @media (max-width: 48rem) - unneccesary 2026-06-04 13:13:58 +02:00
johannes.vos 65153db414 style(search): implement responsive mobile spacing for slogan via media query 2026-06-04 13:11:55 +02:00
johannes.vos 58e4640965 style(search): add desktop vertical spacing and fix line-height for slogan 2026-06-04 13:10:43 +02:00
5 changed files with 125 additions and 6 deletions
+1
View File
@@ -17,6 +17,7 @@
"vue-router": "^5.0.6" "vue-router": "^5.0.6"
}, },
"devDependencies": { "devDependencies": {
"@vue/test-utils": "^2.4.6",
"@vitejs/plugin-vue": "^6.0.6", "@vitejs/plugin-vue": "^6.0.6",
"jsdom": "^29.1.1", "jsdom": "^29.1.1",
"vite": "^8.0.10", "vite": "^8.0.10",
+5 -2
View File
@@ -42,15 +42,18 @@ watch(colorScheme, val => updateColorScheme(val))
</template> </template>
<style scoped> <style scoped>
.main-content { #app-wrapper {
--main-content-padding-x: 30px; --main-content-padding-x: 30px;
--main-content-padding-y: 40px; --main-content-padding-y: 40px;
--main-content-padding: var(--main-content-padding-y) var(--main-content-padding-x); --main-content-padding: var(--main-content-padding-y) var(--main-content-padding-x);
}
.main-content {
flex-grow: 1; flex-grow: 1;
} }
@media (max-width: 48rem) { @media (max-width: 48rem) {
.main-content { #app-wrapper {
--main-content-padding-x: 15px; --main-content-padding-x: 15px;
} }
} }
+1 -1
View File
@@ -42,7 +42,7 @@ import NavbarSearchBarWrapper from './NavbarSearchBarWrapper.vue';
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 18px 40px; padding: 18px var(--main-content-padding-x);
height: 42px; height: 42px;
} }
@@ -0,0 +1,114 @@
/*
Copyright 2026 Seekra
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { expect, test, describe, vi, beforeEach } from 'vitest';
import { mount } from '@vue/test-utils';
import LanguageSwitchButton from '../LanguageSwitchButton.vue';
import { loadLanguage } from '@/i18n';
vi.mock('@/i18n', () => ({
loadLanguage: vi.fn(() => Promise.resolve()),
LANGUAGES_RTL: ['ar', 'he'],
SUPPORTED_LANGUAGES: ['en', 'de', 'ar']
}));
vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: (key) => key,
locale: { value: 'de' }
})
}));
vi.mock('@/features/icons/components/Icon.vue', () => ({
default: {
name: 'Icon',
template: '<span>Icon</span>'
}
}));
describe('LanguageSwitchButton.vue', () => {
beforeEach(() => {
vi.clearAllMocks();
localStorage.clear();
document.documentElement.lang = '';
document.documentElement.dir = '';
});
test('renders correctly with initial state closed', () => {
const wrapper = mount(LanguageSwitchButton);
expect(wrapper.find('.language-button').exists()).toBe(true);
expect(wrapper.find('.language-dropdown').exists()).toBe(false);
expect(wrapper.find('.language-button').attributes('aria-expanded')).toBe('false');
});
test('opens the dropdown when language button is clicked', async () => {
const wrapper = mount(LanguageSwitchButton);
const button = wrapper.find('.language-button');
await button.trigger('click');
expect(wrapper.find('.language-dropdown').exists()).toBe(true);
expect(button.attributes('aria-expanded')).toBe('true');
});
const languageTestCases = [
{ code: 'en', expectedDir: 'ltr' },
{ code: 'de', expectedDir: 'ltr' },
{ code: 'ar', expectedDir: 'rtl' }
];
test.for(languageTestCases)('selectLanguage($code) sets localStorage, html attributes and changes layout direction to $expectedDir', async ({ code, expectedDir }) => {
const wrapper = mount(LanguageSwitchButton);
await wrapper.find('.language-button').trigger('click');
const options = wrapper.findAll('.language-dropdown li');
const optionToClick = options.find(opt => opt.text().includes(code));
await optionToClick.trigger('click');
expect(loadLanguage).toHaveBeenCalledWith(code);
expect(localStorage.getItem('locale')).toBe(code);
expect(document.documentElement.lang).toBe(code);
expect(document.documentElement.dir).toBe(expectedDir);
expect(wrapper.find('.language-dropdown').exists()).toBe(false);
});
test('closes the dropdown when clicking outside the component', async () => {
const wrapper = mount(LanguageSwitchButton, {
attachTo: document.body
});
await wrapper.find('.language-button').trigger('click');
expect(wrapper.find('.language-dropdown').exists()).toBe(true);
await new Promise(resolve => setTimeout(resolve, 0));
const externalDiv = document.createElement('div');
document.body.appendChild(externalDiv);
const clickEvent = new MouseEvent('click', { bubbles: true });
externalDiv.dispatchEvent(clickEvent);
await wrapper.vm.$nextTick();
expect(wrapper.find('.language-dropdown').exists()).toBe(false);
wrapper.unmount();
externalDiv.remove();
});
});
+3 -2
View File
@@ -67,9 +67,10 @@ const submitSearch = function () {
max-width: 100%; max-width: 100%;
} }
.slogan{ .slogan {
margin: 0; margin-top: 1rem;
font-size: small; font-size: small;
line-height: normal;
} }
.search-container { .search-container {