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

fix: event bubbling wrong when clicking on month day event #216

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/components/month/Day.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'is-selected': isSelected,
'is-today': isToday,
}"
@click="emitDayWasClicked"
@click.self="emitDayWasClicked"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dragleave="handleDragLeave"
@dragover="handleDragOver"
@drop="handleDrop"
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/components/month/Day.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ describe("Day.vue", () => {
expect(underTest.emitted("date-was-clicked")[0][0]).toBe("2022-05-23");
});

it('should not emit "date-was-clicked" when an event is clicked', () => {
const underTest = day({ props: defaultProps });
const dayEvent = underTest.find(".calendar-month__event");

dayEvent.trigger("click");

expect(underTest.emitted("date-was-clicked")).toBeFalsy();
})

it('should not emit custom event "day-was-selected" when qalendar !isSmall and a day is clicked', async () => {
const underTest = day({ props: {
...defaultProps,
Expand Down