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(useOffsetPagination): min value for pageCount should be 1 #2001

Merged
merged 3 commits into from Aug 4, 2022

Conversation

jd-solanki
Copy link
Contributor

Description

This will fix the useOffsetPagination issue discussed here.

Additional context

I noticed while editing this composable, it's demo wasn't rendering IDK why 🤔

Moreover, I don't know how to test so please add test for total 0.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
@jd-solanki jd-solanki requested a review from antfu July 27, 2022 06:25
@antfu
Copy link
Member

antfu commented Jul 27, 2022

Might be good to add some tests for it at this point

@jd-solanki
Copy link
Contributor Author

Unfortunately, I don't know how to write tests 😢

@jd-solanki
Copy link
Contributor Author

Can't we merge this without that test?

I want to enable these demos: https://anu-vue.netlify.app/guide/components/table.html#filtering

Regards.

@curtgrimes
Copy link
Contributor

I'm happy to help contribute a test for the updated behavior. Here is a commit that adds tests and removes an unused useMin import: curtgrimes@85e8e13

@jd-solanki Some great resources for writing tests like these are looking at existing tests like this one for useOffsetPagination, and in my opinion GitLab's documentation on tests has some great examples. You can run tests in this project with pnpm test, pnpm test:2 (for running tests under Vue 2), and pnpm test:3 (for running tests under Vue 3). Much of the documentation written for Jest out there will also largely apply to Vitest tests. Hope this helps. Let me know if I can help further!

@jd-solanki
Copy link
Contributor Author

Thanks, @curtgrimes for the commit reference. I really appreciate the help here 🙏🏻

@antfu can you review the PR?

@antfu antfu merged commit b6503dc into vueuse:main Aug 4, 2022
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

3 participants