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 debounce function bug when immediate is true #243

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LongchongWang
Copy link

When immediate is true, the debounced func will never called.

When immediate is true, the debounced func will never called.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 194ec29 on LongchongWang:master into 5665d8a on you-dont-need:master.

@coveralls
Copy link

coveralls commented Dec 5, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling ac47683 on LongchongWang:master into 5665d8a on you-dont-need:master.

@stevemao
Copy link
Member

stevemao commented Dec 5, 2019

Thanks. Could you add a test for that?

@LongchongWang
Copy link
Author

Thanks. Could you add a test for that?

OK, I've added it.

@stevemao
Copy link
Member

Thank you so much!


setTimeout(() => {
if (callCount === 2 && intervalCount === 3) done();
else done(`callCount = ${callCount}`);
Copy link
Member

Choose a reason for hiding this comment

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

Where is assertion? Honestly i don't understand this test, you should stub () => callCount++ and check how many calls debounce called this method

Copy link
Author

Choose a reason for hiding this comment

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

Actually it's my first test unit, but I think it does work. It's true I didn't write any "assert" keyword to do the assertion, but I did use "done" which I think did the job well. Although, stub may be a good way to finish the job but I think stub is not available in mochaJs or assert module. It's not wise to import extra modules when the job can be done easily, at least for me.

Choose a reason for hiding this comment

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

@ODudek Any updates?

@mrienstra
Copy link

Looks like this can be closed due to the merge of #362

@cht8687 cht8687 force-pushed the master branch 2 times, most recently from 5559a1c to bd9b25e Compare September 2, 2023 04:22
@vassudanagunta
Copy link

Is there a reason this is still open? See #362.

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.

None yet

7 participants