generated from Seekra/repository-template
Language switch button unit test #108
@@ -45,4 +45,22 @@ describe('LanguageSwitchButton.vue', () => {
|
|||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
document.documentElement.lang = '';
|
document.documentElement.lang = '';
|
||||||
document.documentElement.dir = '';
|
document.documentElement.dir = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
test('renders correctly with initial state closed', () => {
|
||||||
|
jakob.scheid marked this conversation as resolved
Outdated
|
|||||||
|
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');
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user
Could you please fix the indentation to make it more readable?