Merge pull request #4800 from consul/checkbox_label_styles
Fix checkbox label styles
This commit is contained in:
@@ -1063,6 +1063,10 @@ form {
|
|||||||
line-height: $line-height;
|
line-height: $line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.checkbox-label {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
fieldset legend {
|
fieldset legend {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,11 @@
|
|||||||
@include breakpoint(medium) {
|
@include breakpoint(medium) {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
|
|||||||
else
|
else
|
||||||
label = tag.span sanitize(label_text(attribute, options[:label])), class: "checkbox"
|
label = tag.span sanitize(label_text(attribute, options[:label])), class: "checkbox"
|
||||||
|
|
||||||
super(attribute, options.merge(label: label, label_options: label_options_for(options)))
|
super(attribute, options.merge(
|
||||||
|
label: label,
|
||||||
|
label_options: { class: "checkbox-label" }.merge(label_options_for(options))
|
||||||
|
))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ describe ConsulFormBuilder do
|
|||||||
before do
|
before do
|
||||||
dummy_model = Class.new do
|
dummy_model = Class.new do
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
attr_accessor :title, :quality
|
attr_accessor :title, :quality, :published
|
||||||
end
|
end
|
||||||
|
|
||||||
stub_const("DummyModel", dummy_model)
|
stub_const("DummyModel", dummy_model)
|
||||||
@@ -75,6 +75,15 @@ describe ConsulFormBuilder do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#check_box" do
|
||||||
|
it "adds a checkbox-label class to the label by default" do
|
||||||
|
render builder.check_box(:published)
|
||||||
|
|
||||||
|
expect(page).to have_css "label", count: 1
|
||||||
|
expect(page).to have_css ".checkbox-label"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
attr_reader :content
|
attr_reader :content
|
||||||
|
|
||||||
def render(content)
|
def render(content)
|
||||||
|
|||||||
Reference in New Issue
Block a user