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', () => { ...@@ -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 }); wrapper.setData({ isDropdownSearching: false });
const errorMutationResult = { const errorMutationResult = {
data: { data: {
...@@ -137,11 +137,14 @@ describe('Alert Details Sidebar Assignees', () => { ...@@ -137,11 +137,14 @@ describe('Alert Details Sidebar Assignees', () => {
}; };
jest.spyOn(wrapper.vm.$apollo, 'mutate').mockResolvedValue(errorMutationResult); jest.spyOn(wrapper.vm.$apollo, 'mutate').mockResolvedValue(errorMutationResult);
return wrapper.vm
return wrapper.vm.$nextTick().then(() => { .$nextTick()
.then(() => {
const SideBarAssigneeItem = wrapper.findAll(SidebarAssignee).at(0); const SideBarAssigneeItem = wrapper.findAll(SidebarAssignee).at(0);
SideBarAssigneeItem.vm.$emit('click'); SideBarAssigneeItem.vm.$emit('update-alert-assignees');
expect(wrapper.emitted('alert-refresh')).toBeUndefined(); })
.then(() => {
expect(wrapper.emitted('alert-error')).toBeDefined();
}); });
}); });
......
...@@ -106,7 +106,7 @@ describe('Board List Header Component', () => { ...@@ -106,7 +106,7 @@ describe('Board List Header Component', () => {
createComponent(); createComponent();
expect(isCollapsed()).toBe(false); 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(() => { return wrapper.vm.$nextTick().then(() => {
expect(isCollapsed()).toBe(false); expect(isCollapsed()).toBe(false);
......
...@@ -93,7 +93,7 @@ describe('Design discussions component', () => { ...@@ -93,7 +93,7 @@ describe('Design discussions component', () => {
}); });
it('does not render a checkbox in reply form', () => { it('does not render a checkbox in reply form', () => {
findReplyPlaceholder().vm.$emit('onMouseDown'); findReplyPlaceholder().vm.$emit('onClick');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findResolveCheckbox().exists()).toBe(false); expect(findResolveCheckbox().exists()).toBe(false);
......
...@@ -89,7 +89,7 @@ describe('Design discussions component', () => { ...@@ -89,7 +89,7 @@ describe('Design discussions component', () => {
}); });
it('does not render a checkbox in reply form', () => { it('does not render a checkbox in reply form', () => {
findReplyPlaceholder().vm.$emit('onMouseDown'); findReplyPlaceholder().vm.$emit('onClick');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findResolveCheckbox().exists()).toBe(false); 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