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

feat(tooltip): make event tooltip display delay configurable #796

Closed
wants to merge 1 commit into from

Conversation

mikebaum
Copy link

@mikebaum mikebaum commented Nov 5, 2018

Here's the pull request for Issue #790, that Jelle raised. I wasn't able to test the changes by building the calendar and swapping it out in our project, but I was able to test by copying the directive with it's changes into our project and then using that tooltip directive.

@codecov-io
Copy link

Codecov Report

Merging #796 into master will decrease coverage by 0.63%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #796      +/-   ##
==========================================
- Coverage   96.98%   96.34%   -0.64%     
==========================================
  Files          38       38              
  Lines         861      876      +15     
  Branches      116      118       +2     
==========================================
+ Hits          835      844       +9     
- Misses          0        4       +4     
- Partials       26       28       +2
Impacted Files Coverage Δ
...r/src/modules/week/calendar-week-view.component.ts 96.42% <100%> (+0.01%) ⬆️
...c/modules/day/calendar-day-view-event.component.ts 100% <100%> (ø) ⬆️
...src/modules/month/calendar-month-view.component.ts 94.31% <100%> (+0.06%) ⬆️
...dar/src/modules/day/calendar-day-view.component.ts 95.83% <100%> (+0.03%) ⬆️
...src/modules/month/calendar-month-cell.component.ts 100% <100%> (ø) ⬆️
...modules/week/calendar-week-view-event.component.ts 100% <100%> (ø) ⬆️
...r/src/modules/common/calendar-tooltip.directive.ts 85.18% <33.33%> (-10.38%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5fe1f9...bed99bf. Read the comment docs.

Copy link
Owner

@mattlewis92 mattlewis92 left a comment

Choose a reason for hiding this comment

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

Nice one, thank you! This will actually throw an error if the component is destroyed before the timeout fires. This can be worked around by adding a flag in the ngOnDestroy hook and checking for this here.

Or you could use rxjs to do the timeout:

timer(this.delay).pipe(
  takeUntil(merge(this.destroy$, this.mouseLeave$))
).subscribe(() => this.show())

btw to test your changes locally you can checkout the repo and do:

npm install
npm start

and then edit one of the demos to add the tooltip delay

Also can you add a test for the tooltip delay? You can copy from this one and instead of flushing all timeouts here you can do something like:

tick(delay - 1);
expect(!!document.body.querySelector('.cal-tooltip')).to.equal(false);
tick(1);
expect(!!document.body.querySelector('.cal-tooltip')).to.equal(true);

Let me know if you need any more info! 😄

@mattlewis92 mattlewis92 changed the base branch from master to 0.27 November 6, 2018 05:18
@mattlewis92 mattlewis92 changed the base branch from 0.27 to master November 6, 2018 05:18
@mattlewis92
Copy link
Owner

Hey @mikebaum, reckon you'll be able to take a look at the review comments some time? No worries if not! 😄

@mattlewis92
Copy link
Owner

Landed here: #891 and now available in the next beta: npm i angular-calendar@next Thanks for your contribution! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants