Commit 3230eaf4 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'vs/migrate-emit-multiargs-in-sidebar' into 'master'

Replace $emit call with a single arg in sidebar

See merge request gitlab-org/gitlab!64510
parents 0790bb72 797612bc
......@@ -103,7 +103,7 @@ export default {
dueDateTimeFromMilestones: this.dueDateTimeFromMilestones,
});
},
changeStartDateType(dateTypeIsFixed, typeChangeOnEdit) {
changeStartDateType({ dateTypeIsFixed, typeChangeOnEdit }) {
this.toggleStartDateType({ dateTypeIsFixed });
if (!typeChangeOnEdit) {
this.saveDate({
......@@ -120,7 +120,7 @@ export default {
dateTypeIsFixed: true,
});
},
changeDueDateType(dateTypeIsFixed, typeChangeOnEdit) {
changeDueDateType({ dateTypeIsFixed, typeChangeOnEdit }) {
this.toggleDueDateType({ dateTypeIsFixed });
if (!typeChangeOnEdit) {
this.saveDate({
......
......@@ -133,7 +133,7 @@ export default {
methods: {
stopEditing() {
this.editing = false;
this.$emit('toggleDateType', true, true);
this.$emit('toggleDateType', { dateTypeIsFixed: true, typeChangeOnEdit: true });
},
startEditing(e) {
this.editing = true;
......@@ -144,7 +144,7 @@ export default {
this.$emit('saveDate', date);
},
toggleDateType(dateTypeFixed) {
this.$emit('toggleDateType', dateTypeFixed);
this.$emit('toggleDateType', { dateTypeIsFixed: dateTypeFixed });
},
toggleSidebar() {
this.$emit('toggleCollapse');
......
......@@ -68,7 +68,7 @@ describe('EpicSidebarComponent', () => {
it('calls `toggleStartDateType` on component with `dateTypeIsFixed` param', () => {
jest.spyOn(wrapper.vm, 'toggleStartDateType');
wrapper.vm.changeStartDateType(true, true);
wrapper.vm.changeStartDateType({ dateTypeIsFixed: true, typeChangeOnEdit: true });
expect(wrapper.vm.toggleStartDateType).toHaveBeenCalledWith(
expect.objectContaining({
......@@ -80,7 +80,7 @@ describe('EpicSidebarComponent', () => {
it('calls `saveDate` on component when `typeChangeOnEdit` param false', () => {
jest.spyOn(wrapper.vm, 'saveDate');
wrapper.vm.changeStartDateType(true, false);
wrapper.vm.changeStartDateType({ dateTypeIsFixed: true, typeChangeOnEdit: false });
expect(wrapper.vm.saveDate).toHaveBeenCalledWith(
expect.objectContaining({
......@@ -112,7 +112,7 @@ describe('EpicSidebarComponent', () => {
it('calls `toggleDueDateType` on component with `dateTypeIsFixed` param', () => {
jest.spyOn(wrapper.vm, 'toggleDueDateType');
wrapper.vm.changeDueDateType(true, true);
wrapper.vm.changeDueDateType({ dateTypeIsFixed: true, typeChangeOnEdit: true });
expect(wrapper.vm.toggleDueDateType).toHaveBeenCalledWith(
expect.objectContaining({
......@@ -124,7 +124,7 @@ describe('EpicSidebarComponent', () => {
it('calls `saveDate` on component when `typeChangeOnEdit` param false', () => {
jest.spyOn(wrapper.vm, 'saveDate');
wrapper.vm.changeDueDateType(true, false);
wrapper.vm.changeDueDateType({ dateTypeIsFixed: true, typeChangeOnEdit: false });
expect(wrapper.vm.saveDate).toHaveBeenCalledWith(
expect.objectContaining({
......
......@@ -146,7 +146,9 @@ describe('SidebarDatePicker', () => {
.$nextTick()
.then(() => {
wrapper.find(DatePicker).vm.$emit('hidePicker');
expect(wrapper.emitted().toggleDateType[0]).toStrictEqual([true, true]);
expect(wrapper.emitted().toggleDateType[0]).toStrictEqual([
{ dateTypeIsFixed: true, typeChangeOnEdit: true },
]);
})
.then(() => wrapper.vm.$nextTick())
.then(() => {
......@@ -184,7 +186,7 @@ describe('SidebarDatePicker', () => {
wrapper.find('input').trigger('click');
return wrapper.vm.$nextTick(() => {
expect(wrapper.emitted().toggleDateType).toStrictEqual([[true]]);
expect(wrapper.emitted().toggleDateType).toStrictEqual([[{ dateTypeIsFixed: true }]]);
});
});
......
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