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

Add test for title prefix #2602

Merged
merged 1 commit into from May 3, 2022
Merged

Add test for title prefix #2602

merged 1 commit into from May 3, 2022

Conversation

jcoyne
Copy link
Member

@jcoyne jcoyne commented Jan 12, 2022

No description provided.

@barmintor
Copy link
Contributor

Does the ViewComponent initializer take a block? I know render/render_in work this way, and an after-initialization call to title would work:

  context 'with before_title' do
    before do
      component.title do |c|
        c.before_title { 'Prefix!' } # could also override the let for :render
      end
    end

    it 'shows the prefix' do
      expect(rendered).to have_content "Prefix!"
    end
  end
end

If the base ViewComponent initializer doesn't yield to a block and we want it to, we could also add a block behavior to Blacklight::Component#initialize?

@barmintor
Copy link
Contributor

Re-based and updated the test to configure the slot with a black to render_in, since that seems to be the most like our actual use cases in Blacklight.

@barmintor barmintor requested a review from cbeer May 2, 2022 17:46
@barmintor barmintor marked this pull request as ready for review May 2, 2022 17:46
@barmintor barmintor merged commit ed830f8 into main May 3, 2022
@barmintor barmintor deleted the prefix_test branch May 3, 2022 21:18
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

2 participants