-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Change boolean field to show dash when null * Update app/components/avo/fields/boolean_field/index_component.html.erb * Update app/components/avo/fields/boolean_field/show_component.html.erb --------- Co-authored-by: Paul Bob <[email protected]>
- Loading branch information
Showing
3 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
app/components/avo/fields/boolean_field/index_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<%= index_field_wrapper **field_wrapper_args, dash_if_blank: false, flush: true do %> | ||
<%= index_field_wrapper **field_wrapper_args, flush: true do %> | ||
<%= render Avo::Fields::Common::BooleanCheckComponent.new checked: @field.value %> | ||
<% end %> |
2 changes: 1 addition & 1 deletion
2
app/components/avo/fields/boolean_field/show_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<%= field_wrapper **field_wrapper_args, dash_if_blank: false do %> | ||
<%= field_wrapper **field_wrapper_args do %> | ||
<%= render Avo::Fields::Common::BooleanCheckComponent.new checked: @field.value %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "BooleanField", type: :system do | ||
describe "with regular input" do | ||
let!(:post) { create :post, name: "My Post", is_featured: nil } | ||
|
||
context "show" do | ||
it "displays the post values" do | ||
visit "/admin/resources/posts/#{post.id}" | ||
|
||
expect(page).to have_text "IS FEATURED" | ||
|
||
expect(find_field_value_element("is_featured")).to have_text empty_dash | ||
end | ||
end | ||
end | ||
end |