Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event emitters tests in action_bar component #2411

Merged
merged 4 commits into from
Jan 27, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,46 @@ describe('ActionBarComponent', () => {
it('should render correctly', () => {
expect(wrapper.element).toMatchSnapshot();
});

it('should emit prettifyCodeChange event when the Prettify Code button is clicked', async () => {
const button = wrapper.find('button.app-button').at(0); // Assuming it's the first button
button.trigger('click');
await wrapper.nextTick();
expect(wrapper.emitted('prettifyCodeChange')).toBeTruthy();
});

it('should emit clearEditorChange event when the Clear Editor button is clicked', async () => {
const button = wrapper.find('button.app-button').at(1); // Assuming it's the second button
button.trigger('click');
await wrapper.nextTick();
expect(wrapper.emitted('clearEditorChange')).toBeTruthy();
});

it('should emit toggleHeaderDialog event when the Set Headers button is clicked', async () => {
const button = wrapper.find('button.app-button').at(2); // Adjust index as needed
button.trigger('click');
await wrapper.nextTick();
expect(wrapper.emitted('toggleHeaderDialog')).toBeTruthy();
});

it('should emit toggleVariableDialog event when the Set Variables button is clicked', async () => {
const button = wrapper.find('button.app-button').at(3); // Adjust index as needed
button.trigger('click');
await wrapper.nextTick();
expect(wrapper.emitted('toggleVariableDialog')).toBeTruthy();
});

it('should emit reloadDocsChange event when the Reload Docs button is clicked', async () => {
const button = wrapper.find('button.app-button').at(5); // Adjust index as needed
button.trigger('click');
await wrapper.nextTick();
expect(wrapper.emitted('reloadDocsChange')).toBeTruthy();
});

it('should apply active-grey class to Show Docs button when showDocs is true', async () => {
wrapper.setProps({ showDocs: true });
await wrapper.nextTick();
const button = wrapper.find('button.app-button').at(6); // Adjust index as needed
expect(button.classes()).toContain('active-grey');
});
});
Loading