Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[PLAY-47] Allow rails pb_title to accept child text #1698

Merged
merged 2 commits into from
Dec 20, 2021
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<%= pb_rails("title", props: { text: "Default Title" }) %>
<%= pb_rails("title", props: {
}) do %>
Default Title
<% end %>

<br/>

Expand Down
6 changes: 4 additions & 2 deletions playbook/app/pb_kits/playbook/pb_title/title.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<%= content_tag(object.tag, object.text,
<%= content_tag(object.tag,
aria: object.aria,
id: object.id,
data: object.data,
class: object.classname) %>
class: object.classname) do %>
<%= content.presence || object.text %>
<% end %>
1,034 changes: 517 additions & 517 deletions playbook/dist/playbook-doc.js

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions playbook/dist/playbook-rails.js

Large diffs are not rendered by default.

240 changes: 120 additions & 120 deletions playbook/dist/playbook.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions playbook/spec/pb_kits/playbook/kits/title_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@
expect(subject.new(size: 4, variant: "link").classname).to eq "pb_title_kit_4_link"
end
end

describe "rendered content" do
it "contains content if text is passed to the block" do
expect((subject.new({}) { "sample text" }).children).to be_truthy
end
end
end