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

test: Add a unit test for "$off event and this event added by $once" #9550

Merged
merged 5 commits into from
Feb 28, 2019
Merged

test: Add a unit test for "$off event and this event added by $once" #9550

merged 5 commits into from
Feb 28, 2019

Conversation

wujieZ
Copy link
Contributor

@wujieZ wujieZ commented Feb 22, 2019

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe: add a unit test for "$off event and this event added by $once"

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

Copy link
Member

@Justineo Justineo left a comment

Choose a reason for hiding this comment

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

Files in packages are automatically generated at build time, please do not include them in the PR. Thanks!

@wujieZ
Copy link
Contributor Author

wujieZ commented Feb 22, 2019

Files in packages are automatically generated at build time, please do not include them in the PR. Thanks!

Files in packages are automatically generated at build time, please do not include them in the PR. Thanks!
Thanks, I had revert file what I change in packages

Copy link
Member

@jkzing jkzing left a comment

Choose a reason for hiding this comment

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

Thanks for contributing. But I'm afraid this part cannot be removed.

After removing these two lines, if user call vm.$off before the event is triggered, it won't work.

eg.

const fn = () => console.log('foo')
this.$once('foo', fn)
this.$off('foo', fn) // this won't work

Since we don't have unit test to cover this case, if you still willing to contribute, add a unit test for it would be appreciated.

@wujieZ
Copy link
Contributor Author

wujieZ commented Feb 25, 2019

Thanks for contributing. But I'm afraid this part cannot be removed.

After removing these two lines, if user call vm.$off before the event is triggered, it won't work.

eg.

const fn = () => console.log('foo')
this.$once('foo', fn)
this.$off('foo', fn) // this won't work

Since we don't have unit test to cover this case, if you still willing to contribute, add a unit test for it would be appreciated.

Thanks, I will revert what I change and add a unit test for this.

@wujieZ wujieZ changed the title tweak: This code is not required here test: Add a unit test for $once-$off Feb 25, 2019
@wujieZ wujieZ changed the title test: Add a unit test for $once-$off test: Add a unit test for "$off event and this event add by $once" Feb 26, 2019
@wujieZ wujieZ changed the title test: Add a unit test for "$off event and this event add by $once" test: Add a unit test for "$off event and this event added by $once" Feb 26, 2019
colinyeah and others added 2 commits February 26, 2019 11:16
@yyx990803 yyx990803 merged commit 1574ade into vuejs:dev Feb 28, 2019
@wujieZ wujieZ deleted the event-once-off branch March 1, 2019 10:17
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

5 participants