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 for to being off by one #158

Merged
merged 1 commit into from
Sep 26, 2024
Merged

fix for to being off by one #158

merged 1 commit into from
Sep 26, 2024

Conversation

dnoneill
Copy link
Collaborator

@dnoneill dnoneill commented Sep 24, 2024

@dnoneill dnoneill force-pushed the one-off branch 5 times, most recently from 30f251d to 7065047 Compare September 25, 2024 16:49
.github/workflows/ruby.yml Outdated Show resolved Hide resolved
@dnoneill dnoneill force-pushed the one-off branch 5 times, most recently from 9fd0cea to 21499fa Compare September 25, 2024 19:25
@@ -51,6 +51,14 @@
expect(rendered).to have_selector '.thumbnail img[@src="http://example.com/image.jpg"]'
end

it 'renders the correct slide number' do
if VIEW_COMPONENT_VERSION < 3
expect(rendered).to have_css '[data-slide-to=\"4\"][data-bs-slide-to=\"4\"]'
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the idea that these numbers should be the same regardless of what version of VC is used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not in the component.

It inherits from https://github.com/projectblacklight/blacklight/blob/v8.4.0/app/components/blacklight/document_component.rb#L26C1-L26C72

VIEW_COMPONENT_VERSION = 2, then the COLLECTION_INDEX_OFFSET = 0
VIEW_COMPONENT_VERSION = 3, then the COLLECTION_INDEX_OFFSET = 1

VIEW_COMPONENT_VERSION = 2, @count = 0 + 5 (document_counter, which we set in the test)
VIEW_COMPONENT_VERSION = 3, @count = 1 + 5 (document_counter, which we set in the test)

The component removes - 1 so it is right.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, so because the input will be different for each version, it's going to result in the same output.

@jcoyne jcoyne merged commit 997fc63 into main Sep 26, 2024
7 checks passed
@jcoyne jcoyne deleted the one-off branch September 26, 2024 18:50
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.

Off by one error in blacklight gallery slideshow #2567
2 participants