Commit f33410af authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'xanf-fix-weird-tests' into 'master'

Fix wrong calls to `.$emit`

See merge request gitlab-org/gitlab!40449
parents 9c56c6b9 6a1e3d69
......@@ -125,7 +125,7 @@ describe('Alert Details Sidebar Assignees', () => {
});
});
it('shows an error when request contains error messages', () => {
it('emits an error when request contains error messages', () => {
wrapper.setData({ isDropdownSearching: false });
const errorMutationResult = {
data: {
......@@ -137,12 +137,15 @@ describe('Alert Details Sidebar Assignees', () => {
};
jest.spyOn(wrapper.vm.$apollo, 'mutate').mockResolvedValue(errorMutationResult);
return wrapper.vm.$nextTick().then(() => {
const SideBarAssigneeItem = wrapper.findAll(SidebarAssignee).at(0);
SideBarAssigneeItem.vm.$emit('click');
expect(wrapper.emitted('alert-refresh')).toBeUndefined();
});
return wrapper.vm
.$nextTick()
.then(() => {
const SideBarAssigneeItem = wrapper.findAll(SidebarAssignee).at(0);
SideBarAssigneeItem.vm.$emit('update-alert-assignees');
})
.then(() => {
expect(wrapper.emitted('alert-error')).toBeDefined();
});
});
it('stops updating and cancels loading when the request fails', () => {
......
......@@ -106,7 +106,7 @@ describe('Board List Header Component', () => {
createComponent();
expect(isCollapsed()).toBe(false);
wrapper.find('[data-testid="board-list-header"]').vm.$emit('click');
wrapper.find('[data-testid="board-list-header"]').trigger('click');
return wrapper.vm.$nextTick().then(() => {
expect(isCollapsed()).toBe(false);
......
......@@ -93,7 +93,7 @@ describe('Design discussions component', () => {
});
it('does not render a checkbox in reply form', () => {
findReplyPlaceholder().vm.$emit('onMouseDown');
findReplyPlaceholder().vm.$emit('onClick');
return wrapper.vm.$nextTick().then(() => {
expect(findResolveCheckbox().exists()).toBe(false);
......
......@@ -89,7 +89,7 @@ describe('Design discussions component', () => {
});
it('does not render a checkbox in reply form', () => {
findReplyPlaceholder().vm.$emit('onMouseDown');
findReplyPlaceholder().vm.$emit('onClick');
return wrapper.vm.$nextTick().then(() => {
expect(findResolveCheckbox().exists()).toBe(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment