Commit 0db5382b authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'fguibert/fix-no-change-assignee-widget-no-mutation' into 'master'

Prevent firing mutation when editing and exiting assignee widget without changes [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61089
parents 52bf0fff 1d425a87
......@@ -175,8 +175,10 @@ export default {
this.updateAssignees([this.currentUser.username]);
},
saveAssignees() {
if (this.isDirty) {
this.isDirty = false;
this.updateAssignees(this.selected.map(({ username }) => username));
}
this.$el.dispatchEvent(hideDropdownEvent);
},
collapseWidget() {
......
......@@ -208,6 +208,22 @@ describe('Sidebar assignees widget', () => {
]);
});
it('does not trigger mutation or fire event when editing and exiting without making changes', async () => {
createComponent();
await waitForPromises();
findEditableItem().vm.$emit('open');
await waitForPromises();
findEditableItem().vm.$emit('close');
expect(findEditableItem().props('isDirty')).toBe(false);
expect(updateIssueAssigneesMutationSuccess).toHaveBeenCalledTimes(0);
expect(wrapper.emitted('assignees-updated')).toBe(undefined);
});
describe('when expanded', () => {
beforeEach(async () => {
createComponent();
......
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