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 accordions behavior #420

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/views/people/show.slim
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
.accordion
.accordion-item
h2.accordion-header
button.accordion-button type='button' data-bs-toggle='collapse' data-bs-target="#collapse-project-#{project.slug}" aria-expanded='true' aria-controls="collapse-project-#{project.slug}" class="#{index >= 2 ? 'collapsed' : ''}"
button.accordion-button type='button' data-bs-toggle='collapse' data-bs-target="#collapse-project-#{index}" aria-expanded='true' aria-controls="collapse-project-#{index}" class="#{index >= 2 ? 'collapsed' : ''}"
= project.title
.accordion-collapse.collapse aria-labelledby='projectListHeader' id="collapse-project-#{project.slug}" class="#{index < 2 ? 'show' : ''}"
.accordion-collapse.collapse aria-labelledby='projectListHeader' id="collapse-project-#{index}" class="#{index < 2 ? 'show' : ''}"
.accordion-body
= render 'project', project: project, contributions: @person.project_with_contributions(project)

Expand Down
18 changes: 18 additions & 0 deletions spec/models/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,22 @@
expect(project.top_image).to eq(image)
end
end

describe 'slug validation' do
context 'when slug does not contain a dot' do
it 'is validated correctly' do
project = build(:project, slug: 'slug-name-without-dot')

expect(project).to be_valid
end
end

context 'when slug contains a dot' do
it 'is also validated correctly' do
project = build(:project, slug: 'slug-name-with.dot')

expect(project).to be_valid
end
end
end
end
Loading