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

Chore: unit tests for Thumbnail Sidebar clicks #891

Merged

Conversation

ConradJChan
Copy link
Contributor

No description provided.

@boxcla
Copy link

boxcla commented Jan 15, 2019

Verified that @ConradJChan has signed the CLA. Thanks for the pull request!

});

it('should not call the onClickHandler if target is not thumbnail element', () => {
targetEl.classList.remove('bp-thumbnail');
Copy link
Contributor

Choose a reason for hiding this comment

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

very clean!

@@ -265,7 +265,7 @@ class ThumbnailsSidebar {
*/
setCurrentPage(pageNumber) {
const parsedPageNumber = parseInt(pageNumber, 10);
if (!parsedPageNumber || parsedPageNumber < 1 || parsedPageNumber > this.pdfViewer.pagesCount) {
if (!isFinite(parsedPageNumber) || parsedPageNumber < 1 || parsedPageNumber > this.pdfViewer.pagesCount) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Flipping this assertion might be simpler here.

if (parsedPageNumber >= 1 && parsedPageNumber < this.pdfViewer.pagesCount) {
    this.currentPage = parsedPageNumber;
    this.applyCurrentPageSelection();
}

@ConradJChan ConradJChan merged commit e2f711c into box:thumbnails-sidebar Jan 15, 2019
@ConradJChan ConradJChan deleted the thumbnails-navigation-test branch January 15, 2019 21:57
ConradJChan pushed a commit to ConradJChan/box-content-preview that referenced this pull request Feb 19, 2019
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.

3 participants