Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions __tests__/components.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ function createTestRouter() {
history: createMemoryHistory(),
routes: [
{ path: '/', component: { template: '<div />' } },
{ path: '/profile', component: { template: '<div />' } }
{ path: '/profile', component: { template: '<div />' } },
{ path: '/career', component: { template: '<div />' } },
{ path: '/projects', component: { template: '<div />' } },
{ path: '/contact', component: { template: '<div />' } }
]
});
}

const stubs = {
'v-btn': { template: '<button type="button" class="lang-toggle"><slot /></button>' }
};

afterEach(() => {
setLocale('ja');
});
Expand All @@ -29,7 +28,7 @@ describe('AppHeader', () => {
await router.isReady();

const wrapper = mount(AppHeader, {
global: { plugins: [router, i18n], stubs }
global: { plugins: [router, i18n] }
});

expect(wrapper.findAll('li').length).toBeGreaterThan(0);
Expand All @@ -43,17 +42,20 @@ describe('AppHeader', () => {
await router.isReady();

const wrapper = mount(AppHeader, {
global: { plugins: [router, i18n], stubs }
global: { plugins: [router, i18n] }
});

expect(wrapper.text()).toContain('ホーム');
expect(wrapper.text()).not.toContain('Home');

await wrapper.find('.lang-toggle').trigger('click');
// Open language dropdown
await wrapper.find('.lang-trigger').trigger('click');
// Select English
await wrapper.find('[role="option"]:nth-child(2)').trigger('click');

expect(wrapper.text()).toContain('Home');
expect(wrapper.text()).toContain('Profile');
expect(wrapper.text()).toContain('日本語');
expect(wrapper.text()).toContain('English');
expect(wrapper.text()).not.toContain('ホーム');
});
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"critters": "^0.0.25",
"jsdom": "^30.0.1",
"lefthook": "^2.1.10",
"oxfmt": "^0.62.0",
"oxlint": "^1.77.0",
"oxfmt": "^0.63.0",
"oxlint": "^1.78.0",
"sass": "^1.102.0",
"typescript": "^7.0.2",
"vite": "^8.2.1",
Expand Down
Loading
Loading