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
Member

Language switch button unit test

Add a unit test for the language switch component (src/features/i18n/components/LanguageSwitchButton.vue).

Summary

  • test cases for initial closed state and correct ARIA attributes
  • test cases for opening the dropdown via button click
  • data-driven test matrix (test.for) covering LTR and RTL language selection (including localStorage and HTML document attributes)
  • test case for closing the dropdown when clicking outside the component

Related issues

Closes: #86

# Language switch button unit test Add a unit test for the language switch component (src/features/i18n/components/LanguageSwitchButton.vue). ## Summary * test cases for initial closed state and correct ARIA attributes * test cases for opening the dropdown via button click * data-driven test matrix (test.for) covering LTR and RTL language selection (including localStorage and HTML document attributes) * test case for closing the dropdown when clicking outside the component ## Related issues Closes: #86
johannes.vos added this to the testing-ready milestone 2026-06-04 13:02:10 +02:00
johannes.vos added the
area
settings
prio
high
type
testing
labels 2026-06-04 13:02:10 +02:00
johannes.vos self-assigned this 2026-06-04 13:02:10 +02:00
johannes.vos added this to the MVP Frontend project 2026-06-04 13:02:10 +02:00
johannes.vos moved this to Review in MVP Frontend on 2026-06-04 13:02:39 +02:00
Owner

Why did you put it into src/utils/__tests__/ instead of src/features/i18n/components/__tests__/?

Why did you put it into `src/utils/__tests__/` instead of `src/features/i18n/components/__tests__/`?
jakob.scheid reviewed 2026-06-04 13:14:35 +02:00
@@ -0,0 +1,114 @@
/*
Owner

Can you please use the variant without the * indentation? That is more common, cleaner and better for automated tools.

Can you please use the variant without the ` * ` indentation? That is more common, cleaner and better for automated tools.
jakob.scheid marked this conversation as resolved
jakob.scheid reviewed 2026-06-04 13:15:12 +02:00
@@ -0,0 +47,4 @@
document.documentElement.dir = '';
});
test('renders correctly with initial state closed', () => {
Owner

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

Could you please fix the indentation to make it more readable?
jakob.scheid marked this conversation as resolved
Owner

The test does not work. Maybe you forgot adding @vue/test-utils to the devDependencies section in package.json?

The test does not work. Maybe you forgot adding `@vue/test-utils` to the `devDependencies` section in `package.json`?
johannes.vos added a new dependency 2026-06-04 13:30:34 +02:00
johannes.vos removed a dependency 2026-06-04 13:30:50 +02:00
Author
Member

The test does not work. Maybe you forgot adding @vue/test-utils to the devDependencies section in package.json?

It workes for me.

> The test does not work. Maybe you forgot adding `@vue/test-utils` to the `devDependencies` section in `package.json`? It workes for me.
Author
Member

I will improve it!

**I will improve it!**
johannes.vos marked the pull request as work in progress 2026-06-04 13:32:35 +02:00
Author
Member

@jakob.scheid Please try again.

@jakob.scheid Please try again.
johannes.vos marked the pull request as ready for review 2026-06-04 13:38:48 +02:00
jakob.scheid added 10 commits 2026-06-04 13:43:10 +02:00
jakob.scheid force-pushed testing/language-switch from 918d6768e8 to 27f696247d 2026-06-04 13:43:10 +02:00 Compare
jakob.scheid added 12 commits 2026-06-04 13:44:35 +02:00
jakob.scheid added 1 commit 2026-06-04 13:45:26 +02:00
jakob.scheid approved these changes 2026-06-04 13:46:06 +02:00
jakob.scheid left a comment
Owner

Very nice.

Very nice.
jakob.scheid merged commit 5122d93072 into main 2026-06-04 13:46:17 +02:00
jakob.scheid deleted branch testing/language-switch 2026-06-04 13:46:17 +02:00
jakob.scheid moved this to Done in MVP Frontend on 2026-06-04 13:46:25 +02:00
Sign in to join this conversation.