Language switch button unit test #108

Merged
jakob.scheid merged 23 commits from testing/language-switch into main 2026-06-04 13:46:17 +02:00
Showing only changes of commit 0bb0f23347 - Show all commits
1
@@ -45,4 +45,22 @@ describe('LanguageSwitchButton.vue', () => {
localStorage.clear();
document.documentElement.lang = '';
document.documentElement.dir = '';
});
test('renders correctly with initial state closed', () => {
jakob.scheid marked this conversation as resolved Outdated
Outdated
Review

Could you please fix the indentation to make it more readable?

Could you please fix the indentation to make it more readable?
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');
});