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(slidesInView): separation of concerns + added method to public api #51

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

Conversation

pimdewit
Copy link
Collaborator

@pimdewit pimdewit commented Oct 8, 2019

I thought slidesInView would be a nice addition to the public API, it is also a nice opportunity for separation of concerns. I extracted the snippet from _updateSlidesA11y and added it to its own getter.

@pimdewit pimdewit requested a review from ciampo October 8, 2019 17:53
@pimdewit pimdewit self-assigned this Oct 8, 2019
@coveralls
Copy link

coveralls commented Oct 8, 2019

Pull Request Test Coverage Report for Build 68

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 31 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.7%) to 90.214%

Files with Coverage Reduction New Missed Lines %
dist/macro-carousel-test.js 31 90.21%
Totals Coverage Status
Change from base Build 62: -0.7%
Covered Lines: 539
Relevant Lines: 578

💛 - Coveralls

Copy link
Owner

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

  • needs more tests (as per my comment)
  • we should consider refactoring other parts of the code that kind of perform the same calculation (like in the slidesStatusCaption function and in the attributeChanged function
  • we should add docs for this property (and specify it's read-only) (actually, because there is no setter, what happens when writing the value of the property?)


await wcutils.flush();
expect(this.slider.slidesInView).to.deep.equal([0, 1, 2]);
});
Copy link
Owner

Choose a reason for hiding this comment

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

We need more tests:

  • with different values of selected (not just 0)
  • with different values of slidesPerView (definitely at least 1 as well)

And then we need to test for edge cases:

  • what if selected is set on purpose out of range? (e.g. there are 5 slides, and we set selected to 7)
  • what if slidesPerView is set to 0?
  • what if looping is enabled, and the selected slide is the last? slidesInView should be [last, first...]

Any anything else that comes to mind

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

Successfully merging this pull request may close these issues.

3 participants